Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced92152e1 | ||
|
|
22c309e5e6 | ||
|
|
b4922b5c35 | ||
|
|
e455f5c40c | ||
|
|
7fbdfc5c49 | ||
|
|
d78af1d5b9 | ||
|
|
9d3844820f | ||
|
|
1d01a8aa32 | ||
|
|
e5af624e3d | ||
|
|
fe2f9209c6 | ||
|
|
189227f3a1 | ||
|
|
58c33a90d6 | ||
|
|
5a38c6953e | ||
|
|
fcd134a8e1 | ||
|
|
158c66d588 | ||
|
|
14d801fb11 | ||
|
|
93941b5c6a | ||
|
|
62641a2b41 | ||
|
|
ee94071509 | ||
|
|
9770dd6b4c | ||
|
|
8c82f35493 | ||
|
|
71d0e24c39 | ||
|
|
0ceebd055e | ||
|
|
6555f85769 | ||
|
|
6b40d00b5b | ||
|
|
54cfd0e5e6 |
No files matched your search
@@ -4,3 +4,9 @@
|
||||
[submodule "vendor/rini"]
|
||||
path = vendor/rini
|
||||
url = https://github.com/raysan5/rini.git
|
||||
[submodule "vendor/flint"]
|
||||
path = vendor/flint
|
||||
url = https://github.com/waozixyz/flint
|
||||
[submodule "vendor/otfchop"]
|
||||
path = vendor/otfchop
|
||||
url = https://github.com/waozixyz/otfchop
|
||||
@@ -1,4 +1,21 @@
|
||||
# Changelog
|
||||
## [1.2.2] - 2026-06-10
|
||||
### Fixed
|
||||
- Android touch targets now align correctly on devices with navigation bar window insets.
|
||||
|
||||
## [1.2.1] - 2026-06-10
|
||||
### Added
|
||||
- Breath hold display mode setting with circle progress or stopwatch display
|
||||
- Slower speed scale and progressive start speed control
|
||||
|
||||
## [1.2.0] - 2026-06-08
|
||||
### Added
|
||||
- Flint-based UI and theme system
|
||||
- Session volume slider with immediate persistence
|
||||
- Additional language support: Czech (Čeština), Indonesian (Bahasa Indonesia), Japanese (日本語), Korean (한국어), and Chinese (中文)
|
||||
- Proper font glyphs
|
||||
- File picker for import
|
||||
|
||||
## [1.1.9] - 2026-06-04
|
||||
### Added
|
||||
- Hierarchical settings organization with 3 main categories
|
||||
|
||||
@@ -1,636 +1,12 @@
|
||||
CC = gcc
|
||||
WINDRES = windres
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
SRC = src/main.c src/app.c src/ui/ui.c src/ui/text_layout.c src/ui/dpi.c src/locale.c src/theme_meta.c src/theme.c src/data.c src/miniz.c src/file_dialog.c src/android/android_share.c src/tabs/history_tab.c src/tabs/language_tab.c src/tabs/manual_tab.c src/tabs/settings_tab.c
|
||||
INBE_DIR = libinbe
|
||||
INBE_A = $(INBE_DIR)/libinbe.a
|
||||
|
||||
RAYLIB_DIR = vendor/raylib/src
|
||||
RAYLIB_BUILD_DIR = vendor/raylib/build/sdl
|
||||
RAYLIB_A = $(RAYLIB_BUILD_DIR)/libraylib.a
|
||||
|
||||
ANDROID_DIR = droid
|
||||
GRADLE = gradle
|
||||
ANDROID_APP_ID = xyz.waozi.inbe
|
||||
ANDROID_ACTIVITY = android.app.NativeActivity
|
||||
|
||||
# Detect platform and architecture
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
PLATFORM = linux
|
||||
else ifeq ($(UNAME_S),Darwin)
|
||||
PLATFORM = macos
|
||||
else
|
||||
PLATFORM = unknown
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_M),x86_64)
|
||||
ARCH = x86_64
|
||||
else ifeq ($(UNAME_M),aarch64)
|
||||
ARCH = aarch64
|
||||
else ifeq ($(UNAME_M),armv7l)
|
||||
ARCH = arm
|
||||
else
|
||||
ARCH = $(UNAME_M)
|
||||
endif
|
||||
|
||||
# Build output dirs
|
||||
BUILD_DIR = build
|
||||
LINUX_BUILD_DIR = $(BUILD_DIR)/linux
|
||||
WINDOWS_BUILD_DIR = $(BUILD_DIR)/windows
|
||||
ANDROID_BUILD_DIR = $(BUILD_DIR)/android
|
||||
WEB_BUILD_DIR = $(BUILD_DIR)/web
|
||||
LINUX_ARCHES = x86_64 aarch64
|
||||
ANDROID_DIST ?= release
|
||||
|
||||
# Installation paths
|
||||
INSTALL_DIR = $(HOME)/.local/share/inbe
|
||||
BIN_DIR = $(HOME)/bin
|
||||
TARBALL = $(LINUX_BUILD_DIR)/inbe-linux.tar.gz
|
||||
|
||||
# Linux/native target
|
||||
BINARY_NAME = inbe-$(PLATFORM)-$(ARCH)
|
||||
TARGET = $(LINUX_BUILD_DIR)/$(BINARY_NAME)
|
||||
LINUX_INBE_A = $(LINUX_BUILD_DIR)/libinbe.a
|
||||
|
||||
# Windows cross-compilation
|
||||
WIN_CC = x86_64-w64-mingw32-gcc
|
||||
WIN_AR = x86_64-w64-mingw32-ar
|
||||
WIN_WINDRES = x86_64-w64-mingw32-windres
|
||||
WIN_TARGET = $(WINDOWS_BUILD_DIR)/inbe-windows-x86_64.exe
|
||||
WIN_RAYLIB_BUILD_DIR = $(WINDOWS_BUILD_DIR)/raylib
|
||||
WIN_RAYLIB_A = $(WIN_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WIN_RAYLIB_OBJS = \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rcore.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rshapes.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rtextures.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rtext.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/raudio.o
|
||||
WIN_INBE_A = $(WINDOWS_BUILD_DIR)/libinbe.a
|
||||
|
||||
# WebAssembly
|
||||
WEB_CC ?= emcc
|
||||
WEB_AR ?= emar
|
||||
WEB_TARGET = $(WEB_BUILD_DIR)/index.html
|
||||
WEB_RAYLIB_BUILD_DIR = $(WEB_BUILD_DIR)/raylib
|
||||
WEB_RAYLIB_A = $(WEB_RAYLIB_BUILD_DIR)/libraylib.web.a
|
||||
WEB_RAYLIB_OBJS = \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rcore.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rshapes.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rtextures.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rtext.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/raudio.o
|
||||
WEB_CFLAGS = -Wall -Wextra -std=gnu99 -Os -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -D_DEFAULT_SOURCE -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
WEB_SHELL = src/web_shell.html
|
||||
WEB_LOCALE_FILES = $(wildcard locales/*.txt)
|
||||
WEB_LOCALE_PRELOADS = $(foreach file,$(WEB_LOCALE_FILES),--preload-file $(file)@locales/$(notdir $(file)))
|
||||
WEB_ICON_FILES = $(wildcard icons/*.png)
|
||||
WEB_ICON_PRELOADS = $(foreach file,$(WEB_ICON_FILES),--preload-file $(file)@icons/$(notdir $(file)))
|
||||
WEB_THEME_FILES = $(wildcard themes/*.ini)
|
||||
WEB_THEME_PRELOADS = $(foreach file,$(WEB_THEME_FILES),--preload-file $(file)@themes/$(notdir $(file)))
|
||||
WEB_SOUND_FILES = $(wildcard assets/sounds/*)
|
||||
WEB_SOUND_PRELOADS = $(foreach file,$(WEB_SOUND_FILES),--preload-file $(file)@assets/sounds/$(notdir $(file)))
|
||||
WEB_ASSET_FILES = inbe.ini theme.ini assets/angel.jpg assets/begin.jpg $(WEB_LOCALE_FILES) $(WEB_ICON_FILES) $(WEB_THEME_FILES) $(WEB_SOUND_FILES)
|
||||
WEB_LDFLAGS = -sUSE_GLFW=3 -sALLOW_MEMORY_GROWTH=1 -lidbfs.js --shell-file $(WEB_SHELL) $(WEB_LOCALE_PRELOADS) $(WEB_ICON_PRELOADS) $(WEB_THEME_PRELOADS) $(WEB_SOUND_PRELOADS) --preload-file [email protected] --preload-file [email protected] --preload-file assets/angel.jpg@assets/angel.jpg --preload-file assets/begin.jpg@assets/begin.jpg
|
||||
INBE_RAYLIB_CONFIG = $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES
|
||||
LDFLAGS = -Wl,--gc-sections -s
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
# Required shell vars from nix develop
|
||||
ifeq ($(strip $(RAY_CFLAGS)),)
|
||||
$(error RAY_CFLAGS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_LDLIBS)),)
|
||||
$(error RAY_LDLIBS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_LDLIBS)),)
|
||||
$(error RAY_SDL_LDLIBS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_INCLUDE_DIR)),)
|
||||
$(error RAY_SDL_INCLUDE_DIR is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_RAYLIB_CONFIG)),)
|
||||
$(error RAY_RAYLIB_CONFIG is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
|
||||
all: native
|
||||
|
||||
native: $(TARGET)
|
||||
|
||||
build:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
$(LINUX_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WINDOWS_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WIN_RAYLIB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(ANDROID_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WEB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WEB_RAYLIB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(RAYLIB_BUILD_DIR): build
|
||||
mkdir -p $@
|
||||
|
||||
# Native Linux/macOS raylib build
|
||||
$(RAYLIB_A): | $(RAYLIB_BUILD_DIR)
|
||||
$(MAKE) -j1 -C $(RAYLIB_DIR) \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../build/sdl \
|
||||
RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=FALSE \
|
||||
SDL_INCLUDE_PATH="$(RAY_SDL_INCLUDE_DIR)" \
|
||||
SDL_LIBRARIES="$(RAY_SDL_LDLIBS)" \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(INBE_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
# Build native libinbe, then copy it into build/linux
|
||||
$(LINUX_INBE_A): FORCE | $(LINUX_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
$(MAKE) -C $(INBE_DIR) CC=$(CC) AR=ar
|
||||
cp $(INBE_A) $@
|
||||
|
||||
# Native executable
|
||||
$(TARGET): $(SRC) theme.ini inbe.ini $(RAYLIB_A) $(LINUX_INBE_A) | $(LINUX_BUILD_DIR)
|
||||
$(CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-Isrc -Isrc/android \
|
||||
$(RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(LINUX_INBE_A) \
|
||||
$(RAYLIB_A) \
|
||||
$(RAY_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
linux: $(LINUX_ARCHES:%=linux-%)
|
||||
|
||||
linux-x86_64: | $(LINUX_BUILD_DIR)
|
||||
$(MAKE) build-linux-arch \
|
||||
ARCH_NAME=x86_64 \
|
||||
LINUX_CC="$(CC)" \
|
||||
LINUX_AR=ar \
|
||||
LINUX_RAY_CFLAGS="$(RAY_CFLAGS)" \
|
||||
LINUX_RAY_LDLIBS="$(RAY_LDLIBS)" \
|
||||
LINUX_RAY_SDL_LDLIBS="$(RAY_SDL_LDLIBS)" \
|
||||
LINUX_RAY_SDL_INCLUDE_DIR="$(RAY_SDL_INCLUDE_DIR)"
|
||||
|
||||
linux-aarch64: | $(LINUX_BUILD_DIR)
|
||||
@if [ -z "$(AARCH64_CC)" ] || [ -z "$(AARCH64_AR)" ] || [ -z "$(AARCH64_RAY_CFLAGS)" ] || [ -z "$(AARCH64_RAY_LDLIBS)" ] || [ -z "$(AARCH64_RAY_SDL_LDLIBS)" ] || [ -z "$(AARCH64_RAY_SDL_INCLUDE_DIR)" ]; then \
|
||||
echo "AARCH64 cross-build variables are missing. Enter the flake shell with 'nix develop'."; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(MAKE) build-linux-arch \
|
||||
ARCH_NAME=aarch64 \
|
||||
LINUX_CC="$(AARCH64_CC)" \
|
||||
LINUX_AR="$(AARCH64_AR)" \
|
||||
LINUX_RAY_CFLAGS="$(AARCH64_RAY_CFLAGS)" \
|
||||
LINUX_RAY_LDLIBS="$(AARCH64_RAY_LDLIBS)" \
|
||||
LINUX_RAY_SDL_LDLIBS="$(AARCH64_RAY_SDL_LDLIBS)" \
|
||||
LINUX_RAY_SDL_INCLUDE_DIR="$(AARCH64_RAY_SDL_INCLUDE_DIR)"
|
||||
|
||||
build-linux-arch:
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME) vendor/raylib/build/sdl-$(ARCH_NAME)
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
$(MAKE) -j1 -C $(RAYLIB_DIR) \
|
||||
CC="$(LINUX_CC)" \
|
||||
AR="$(LINUX_AR)" \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../build/sdl-$(ARCH_NAME) \
|
||||
RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=FALSE \
|
||||
SDL_INCLUDE_PATH="$(LINUX_RAY_SDL_INCLUDE_DIR)" \
|
||||
SDL_LIBRARIES="$(LINUX_RAY_SDL_LDLIBS)" \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(LINUX_RAY_CFLAGS) $(INBE_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
$(LINUX_CC) $(CFLAGS) -I$(INBE_DIR) -c $(INBE_DIR)/inbe.c -o $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/inbe.o
|
||||
$(LINUX_AR) rcs $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/libinbe.a $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/inbe.o
|
||||
$(LINUX_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-Isrc -Isrc/android \
|
||||
$(LINUX_RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-o $(LINUX_BUILD_DIR)/inbe-linux-$(ARCH_NAME) \
|
||||
$(SRC) \
|
||||
$(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/libinbe.a \
|
||||
vendor/raylib/build/sdl-$(ARCH_NAME)/libraylib.a \
|
||||
$(LINUX_RAY_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
|
||||
# Windows cross-compilation target
|
||||
windows: $(WIN_TARGET)
|
||||
|
||||
# Windows raylib build
|
||||
$(WIN_RAYLIB_BUILD_DIR)/%.o: $(RAYLIB_DIR)/%.c | $(WIN_RAYLIB_BUILD_DIR)
|
||||
$(WIN_CC) \
|
||||
-c $< \
|
||||
-o $@ \
|
||||
-Wall \
|
||||
-D_GNU_SOURCE \
|
||||
-DPLATFORM_DESKTOP_WIN32 \
|
||||
-DGRAPHICS_API_OPENGL_33 \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-Wno-missing-braces \
|
||||
-Werror=pointer-arith \
|
||||
-fno-strict-aliasing \
|
||||
-std=gnu99 \
|
||||
-DUNICODE \
|
||||
$(INBE_RAYLIB_CONFIG) \
|
||||
-Os \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-I$(RAYLIB_DIR)
|
||||
|
||||
$(WIN_RAYLIB_A): $(WIN_RAYLIB_OBJS)
|
||||
$(WIN_AR) rcs $@ $(WIN_RAYLIB_OBJS)
|
||||
|
||||
# WebAssembly target
|
||||
web: $(WEB_TARGET)
|
||||
|
||||
$(WEB_RAYLIB_BUILD_DIR)/%.o: $(RAYLIB_DIR)/%.c | $(WEB_RAYLIB_BUILD_DIR)
|
||||
$(WEB_CC) \
|
||||
-c $< \
|
||||
-o $@ \
|
||||
-Wall \
|
||||
-D_GNU_SOURCE \
|
||||
-DPLATFORM_WEB \
|
||||
-DGRAPHICS_API_OPENGL_ES2 \
|
||||
-Wno-missing-braces \
|
||||
-Werror=pointer-arith \
|
||||
-fno-strict-aliasing \
|
||||
-std=gnu99 \
|
||||
-D_DEFAULT_SOURCE \
|
||||
$(INBE_RAYLIB_CONFIG) \
|
||||
-Os \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-I$(RAYLIB_DIR)
|
||||
|
||||
$(WEB_RAYLIB_A): $(WEB_RAYLIB_OBJS)
|
||||
$(WEB_AR) rcs $@ $(WEB_RAYLIB_OBJS)
|
||||
|
||||
$(WEB_TARGET): Makefile $(SRC) $(INBE_DIR)/inbe.c $(WEB_SHELL) $(WEB_RAYLIB_A) $(WEB_ASSET_FILES) | $(WEB_BUILD_DIR)
|
||||
$(WEB_CC) $(WEB_CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-Isrc -Isrc/android \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(INBE_DIR)/inbe.c \
|
||||
$(WEB_RAYLIB_A) \
|
||||
$(WEB_LDFLAGS)
|
||||
cache_buster=$$(cksum $(WEB_BUILD_DIR)/index.js $(WEB_BUILD_DIR)/index.data $(WEB_BUILD_DIR)/index.wasm | cksum | cut -d ' ' -f 1); \
|
||||
sed -i "s#src=\"index.js\"#src=\"index.js?v=$$cache_buster\"#; s#WEB_CACHE_BUSTER#$$cache_buster#g" $(WEB_TARGET)
|
||||
|
||||
# Build Windows libinbe, then copy it into build/windows
|
||||
$(WIN_INBE_A): FORCE | $(WINDOWS_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
$(MAKE) -C $(INBE_DIR) CC=$(WIN_CC) AR=$(WIN_AR)
|
||||
cp $(INBE_A) $@
|
||||
|
||||
# Windows executable
|
||||
$(WIN_TARGET): $(SRC) $(WIN_RAYLIB_A) $(WIN_INBE_A) | $(WINDOWS_BUILD_DIR)
|
||||
$(WIN_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
-Isrc -Isrc/android \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(WIN_INBE_A) \
|
||||
$(WIN_RAYLIB_A) \
|
||||
-L$(MCFGTHREADS)/lib \
|
||||
-lopengl32 -lgdi32 -lwinmm -lws2_32 \
|
||||
-mwindows \
|
||||
$(LDFLAGS)
|
||||
|
||||
# Cleaning
|
||||
clean:
|
||||
rm -rf build
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-linux:
|
||||
rm -rf $(LINUX_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-windows:
|
||||
rm -rf $(WINDOWS_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-web:
|
||||
rm -rf $(WEB_BUILD_DIR)
|
||||
|
||||
clean-raylib:
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
rm -rf vendor/raylib/build
|
||||
|
||||
# Distribution targets
|
||||
#
|
||||
# These create ONE archive per platform:
|
||||
#
|
||||
# build/linux/inbe-linux.tar.gz
|
||||
# build/windows/inbe-windows.zip
|
||||
#
|
||||
# Each archive includes every matching binary already present in that
|
||||
# platform's build folder.
|
||||
|
||||
dist:
|
||||
$(MAKE) linux
|
||||
$(MAKE) windows
|
||||
$(MAKE) web
|
||||
$(MAKE) android-$(ANDROID_DIST)
|
||||
$(MAKE) android-bundle
|
||||
$(MAKE) dist-linux
|
||||
$(MAKE) dist-windows
|
||||
|
||||
dist-linux: linux
|
||||
@echo "Creating Linux tar.gz package with all Linux arch binaries..."
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux
|
||||
@for bin in $(LINUX_BUILD_DIR)/inbe-linux-*; do \
|
||||
if [ -f "$$bin" ] && [ -x "$$bin" ]; then \
|
||||
echo "Adding $$bin"; \
|
||||
cp "$$bin" "$(LINUX_BUILD_DIR)/dist/inbe-linux/$$(basename "$$bin")"; \
|
||||
fi; \
|
||||
done
|
||||
@if [ -z "$$(find $(LINUX_BUILD_DIR)/dist/inbe-linux -type f 2>/dev/null)" ]; then \
|
||||
echo "No Linux binaries found in $(LINUX_BUILD_DIR)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp inbe.ini theme.ini $(LINUX_BUILD_DIR)/dist/inbe-linux/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/locales
|
||||
@cp locales/*.txt $(LINUX_BUILD_DIR)/dist/inbe-linux/locales/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/themes
|
||||
@cp themes/*.ini $(LINUX_BUILD_DIR)/dist/inbe-linux/themes/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/icons
|
||||
@cp icons/*.png $(LINUX_BUILD_DIR)/dist/inbe-linux/icons/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets
|
||||
@cp assets/angel.jpg assets/begin.jpg $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/sounds
|
||||
@cp assets/sounds/breath-in.ogg assets/sounds/breath-out.ogg assets/sounds/bell.ogg $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/sounds/
|
||||
@cd $(LINUX_BUILD_DIR)/dist && tar -czf ../inbe-linux.tar.gz inbe-linux/
|
||||
@rm -rf $(LINUX_BUILD_DIR)/dist
|
||||
@echo "Created $(LINUX_BUILD_DIR)/inbe-linux.tar.gz"
|
||||
|
||||
install: dist-linux
|
||||
@echo "Installing inbe to $(INSTALL_DIR)..."
|
||||
@mkdir -p $(INSTALL_DIR)
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@tar -xzf $(TARBALL) -C $(INSTALL_DIR)
|
||||
@ARCH=$$(uname -m); \
|
||||
if [ "$$ARCH" != "x86_64" ] && [ "$$ARCH" != "aarch64" ]; then \
|
||||
echo "Warning: Unsupported architecture $$ARCH, defaulting to x86_64"; \
|
||||
ARCH="x86_64"; \
|
||||
fi; \
|
||||
BINARY_PATH="$(INSTALL_DIR)/inbe-linux/inbe-linux-$$ARCH"; \
|
||||
if [ ! -f "$$BINARY_PATH" ]; then \
|
||||
echo "Error: Binary not found: $$BINARY_PATH"; \
|
||||
echo "Available binaries:"; \
|
||||
ls $(INSTALL_DIR)/inbe-linux/inbe-linux-* 2>/dev/null || echo " None"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -L $(BIN_DIR)/inbe ]; then \
|
||||
echo "Removing existing symlink: $(BIN_DIR)/inbe"; \
|
||||
rm $(BIN_DIR)/inbe; \
|
||||
elif [ -e $(BIN_DIR)/inbe ]; then \
|
||||
echo "Error: $(BIN_DIR)/inbe exists and is not a symlink"; \
|
||||
echo "Please remove it manually and try again"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
ln -s "$$BINARY_PATH" $(BIN_DIR)/inbe && \
|
||||
echo "Created symlink: $(BIN_DIR)/inbe -> $$BINARY_PATH" && \
|
||||
echo "" && \
|
||||
echo "Installation complete!" && \
|
||||
echo " Binary: $(BIN_DIR)/inbe" && \
|
||||
echo " Data: $(INSTALL_DIR)/inbe-linux/" && \
|
||||
echo "" && \
|
||||
echo "Run 'inbe' to start the application"
|
||||
|
||||
uninstall:
|
||||
@echo "Uninstalling inbe..."
|
||||
@if [ -L $(BIN_DIR)/inbe ]; then \
|
||||
echo "Removing symlink: $(BIN_DIR)/inbe"; \
|
||||
rm $(BIN_DIR)/inbe; \
|
||||
elif [ -e $(BIN_DIR)/inbe ]; then \
|
||||
echo "Warning: $(BIN_DIR)/inbe exists but is not a symlink"; \
|
||||
echo "Skipping symlink removal"; \
|
||||
fi
|
||||
@if [ -d $(INSTALL_DIR) ]; then \
|
||||
echo "Removing directory: $(INSTALL_DIR)"; \
|
||||
rm -rf $(INSTALL_DIR); \
|
||||
else \
|
||||
echo "Install directory not found: $(INSTALL_DIR)"; \
|
||||
fi
|
||||
@echo "Uninstall complete"
|
||||
|
||||
dist-windows:
|
||||
@echo "Creating Windows zip package with all Windows arch binaries..."
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows
|
||||
@for bin in $(WINDOWS_BUILD_DIR)/inbe-windows-*.exe; do \
|
||||
if [ -f "$$bin" ]; then \
|
||||
echo "Adding $$bin"; \
|
||||
cp "$$bin" "$(WINDOWS_BUILD_DIR)/dist/inbe-windows/$$(basename "$$bin")"; \
|
||||
fi; \
|
||||
done
|
||||
@if [ -z "$$(find $(WINDOWS_BUILD_DIR)/dist/inbe-windows -type f 2>/dev/null)" ]; then \
|
||||
echo "No Windows binaries found in $(WINDOWS_BUILD_DIR)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp inbe.ini theme.ini $(WINDOWS_BUILD_DIR)/dist/inbe-windows/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/locales
|
||||
@cp locales/*.txt $(WINDOWS_BUILD_DIR)/dist/inbe-windows/locales/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes
|
||||
@cp themes/*.ini $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/icons
|
||||
@cp icons/gear.png icons/x.png icons/manual.png icons/return.png icons/backward.png icons/forward.png icons/play.png icons/pause.png icons/stat.png $(WINDOWS_BUILD_DIR)/dist/inbe-windows/icons/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets
|
||||
@cp assets/angel.jpg assets/begin.jpg $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/sounds
|
||||
@cp assets/sounds/breath-in.ogg assets/sounds/breath-out.ogg assets/sounds/bell.ogg $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/sounds/
|
||||
@cd $(WINDOWS_BUILD_DIR)/dist && zip -r ../inbe-windows.zip inbe-windows/
|
||||
@rm -rf $(WINDOWS_BUILD_DIR)/dist
|
||||
@echo "Created $(WINDOWS_BUILD_DIR)/inbe-windows.zip"
|
||||
|
||||
# Android targets
|
||||
android-init-signing:
|
||||
@echo "Generating release keystore..."
|
||||
@mkdir -p ~/.android
|
||||
keytool -genkeypair -v -storetype PKCS12 \
|
||||
-keystore ~/.android/inbe-release.keystore \
|
||||
-alias inbe-key \
|
||||
-keyalg RSA \
|
||||
-keysize 4096 \
|
||||
-validity 10000
|
||||
@echo ""
|
||||
@echo "Keystore created at ~/.android/inbe-release.keystore"
|
||||
@echo ""
|
||||
@echo "Add this line to $(ANDROID_DIR)/local.properties:"
|
||||
@echo " keystore.path=$$HOME/.android/inbe-release.keystore"
|
||||
|
||||
android-copy-assets:
|
||||
rm -rf $(ANDROID_DIR)/app/src/main/assets
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets
|
||||
cp inbe.ini $(ANDROID_DIR)/app/src/main/assets/inbe.ini
|
||||
cp theme.ini $(ANDROID_DIR)/app/src/main/assets/theme.ini
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/locales
|
||||
cp locales/*.txt $(ANDROID_DIR)/app/src/main/assets/locales/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/themes
|
||||
cp themes/*.ini $(ANDROID_DIR)/app/src/main/assets/themes/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/icons
|
||||
@for icon in icons/*.png; do \
|
||||
base=$$(basename "$$icon"); \
|
||||
size=$$(identify -format '%wx%h' "$$icon"); \
|
||||
magick "$$icon" -filter point -resize "$$size!" "$(ANDROID_DIR)/app/src/main/assets/icons/$$base"; \
|
||||
done
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/assets
|
||||
cp assets/angel.jpg assets/begin.jpg $(ANDROID_DIR)/app/src/main/assets/assets/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/assets/sounds
|
||||
cp assets/sounds/breath-in.ogg assets/sounds/breath-out.ogg assets/sounds/bell.ogg $(ANDROID_DIR)/app/src/main/assets/assets/sounds/
|
||||
|
||||
android-debug:
|
||||
$(MAKE) android-copy-assets
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleDebug
|
||||
$(MAKE) android-copy-debug-apks
|
||||
|
||||
android-release:
|
||||
$(MAKE) android-copy-assets
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-release-apks; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-bundle:
|
||||
$(MAKE) android-copy-assets
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) bundleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-bundle; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-bundle: | $(ANDROID_BUILD_DIR)
|
||||
@VERSION=$$(grep -m1 '^## \[' CHANGELOG.md | sed 's/^## \[\([^]]*\)\].*/\1/'); \
|
||||
BUNDLE=$$(find $(ANDROID_DIR)/app/build/outputs/bundle/release -name "*.aab" 2>/dev/null | head -1); \
|
||||
if [ -n "$$BUNDLE" ] && [ -f "$$BUNDLE" ]; then \
|
||||
VERSIONED_BUNDLE="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.aab"; \
|
||||
echo "Copying and renaming $$BUNDLE to $$VERSIONED_BUNDLE"; \
|
||||
cp "$$BUNDLE" "$$VERSIONED_BUNDLE"; \
|
||||
ln -sf "$$(basename "$$VERSIONED_BUNDLE")" "$(ANDROID_BUILD_DIR)/inbe-latest.aab"; \
|
||||
echo "Created symlink: inbe-latest.aab → $$(basename "$$VERSIONED_BUNDLE")"; \
|
||||
else \
|
||||
echo "Bundle not found in $(ANDROID_DIR)/app/build/outputs/bundle/release/"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-apks: android-copy-debug-apks android-copy-release-apks
|
||||
|
||||
android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
|
||||
@for apk in $(ANDROID_DIR)/app/build/outputs/apk/debug/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
echo "Copying $$apk"; \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
@VERSION=$$(grep INBE_VERSION_STRING src/version.h | grep -o '"[^"]*"' | tr -d '"'); \
|
||||
UNIVERSAL_APK=$$(find $(ANDROID_DIR)/app/build/outputs/apk/release -name "app-universal-release.apk" 2>/dev/null); \
|
||||
if [ -n "$$UNIVERSAL_APK" ] && [ -f "$$UNIVERSAL_APK" ]; then \
|
||||
VERSIONED_APK="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.apk"; \
|
||||
echo "Copying and renaming $$UNIVERSAL_APK to $$VERSIONED_APK"; \
|
||||
cp "$$UNIVERSAL_APK" "$$VERSIONED_APK"; \
|
||||
ln -sf "$$(basename "$$VERSIONED_APK")" "$(ANDROID_BUILD_DIR)/inbe-latest.apk"; \
|
||||
echo "Created symlink: inbe-latest.apk → $$(basename "$$VERSIONED_APK")"; \
|
||||
else \
|
||||
for apk in $(ANDROID_DIR)/app/build/outputs/apk/release/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
echo "Copying $$apk"; \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
android-install: android-debug
|
||||
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
|
||||
echo "Device ABI: $$ABI"; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/debug/app-$${ABI}-debug.apk; \
|
||||
if [ ! -f "$$APK" ]; then \
|
||||
echo "APK not found for $$ABI, trying universal..."; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk; \
|
||||
fi; \
|
||||
echo "Installing: $$APK"; \
|
||||
adb install -r "$$APK"
|
||||
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
|
||||
|
||||
android-install-release: android-release
|
||||
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
|
||||
echo "Device ABI: $$ABI"; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/release/app-$${ABI}-release.apk; \
|
||||
if [ ! -f "$$APK" ]; then \
|
||||
echo "APK not found for $$ABI, trying universal..."; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/release/app-release.apk; \
|
||||
fi; \
|
||||
echo "Installing: $$APK"; \
|
||||
adb install -r "$$APK"
|
||||
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
|
||||
|
||||
android-clean:
|
||||
$(GRADLE) -p $(ANDROID_DIR) clean
|
||||
rm -rf $(ANDROID_BUILD_DIR)
|
||||
include mk/common.mk
|
||||
include mk/native.mk
|
||||
include mk/windows.mk
|
||||
include mk/web.mk
|
||||
include mk/android.mk
|
||||
include mk/dist.mk
|
||||
include mk/clean.mk
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 66 KiB |
@@ -7,7 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Inner Breeze - All available builds and implementations.">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="web-assets/icons/favicon-32x32.png">
|
||||
<meta name="theme-color" content="#5566aa">
|
||||
|
||||
</head>
|
||||
@@ -21,7 +21,7 @@
|
||||
<section>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/ray.png" alt="raylib"/>
|
||||
<img src="/web-assets/icons/ray.png" alt="raylib"/>
|
||||
<div>
|
||||
<strong><a href="https://raylib.com">Raylib</a></strong>
|
||||
<p>A C library for video game programming - the primary implementation.</p>
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/wasm4.png" alt="wasm4"/>
|
||||
<img src="/web-assets/icons/wasm4.png" alt="wasm4"/>
|
||||
<div>
|
||||
<strong><a href="https://wasm4.org">WASM-4</a></strong>
|
||||
<p>A tiny fantasy console that runs WebAssembly cartridges.</p>
|
||||
@@ -51,7 +51,7 @@
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/icons/uxn.png" alt="uxn"/>
|
||||
<img src="/web-assets/icons/uxn.png" alt="uxn"/>
|
||||
<div>
|
||||
<strong><a href="https://100r.co/site/uxn.html">Uxn</a></strong>
|
||||
<p>A small virtual computer; <code>.rom</code> runs in a Uxn emulator.</p>
|
||||
|
||||
@@ -34,8 +34,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
targetSdk 35
|
||||
versionCode 20
|
||||
versionName "1.1.9"
|
||||
versionCode 23
|
||||
versionName "1.2.2"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(SRC_DIR "${REPO_ROOT}/src")
|
||||
set(LIBINBE_DIR "${REPO_ROOT}/libinbe")
|
||||
set(RAYLIB_DIR "${REPO_ROOT}/vendor/raylib/src")
|
||||
set(FLINT_DIR "${REPO_ROOT}/vendor/flint")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
|
||||
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/flint_file_dialog.c")
|
||||
|
||||
add_library(raylib STATIC
|
||||
"${RAYLIB_DIR}/rcore.c"
|
||||
@@ -52,18 +55,23 @@ target_include_directories(inbe PUBLIC
|
||||
"${LIBINBE_DIR}"
|
||||
)
|
||||
|
||||
add_library(flint STATIC ${FLINT_SOURCES})
|
||||
|
||||
target_include_directories(flint PUBLIC
|
||||
"${FLINT_DIR}/include"
|
||||
"${RAYLIB_DIR}"
|
||||
)
|
||||
|
||||
add_library(main SHARED
|
||||
"${SRC_DIR}/main.c"
|
||||
"${SRC_DIR}/app.c"
|
||||
"${SRC_DIR}/app_session.c"
|
||||
"${SRC_DIR}/locale.c"
|
||||
"${SRC_DIR}/ui/ui.c"
|
||||
"${SRC_DIR}/ui/text_layout.c"
|
||||
"${SRC_DIR}/ui/dpi.c"
|
||||
"${SRC_DIR}/theme_meta.c"
|
||||
"${SRC_DIR}/theme.c"
|
||||
"${SRC_DIR}/data.c"
|
||||
"${SRC_DIR}/miniz.c"
|
||||
"${SRC_DIR}/file_dialog.c"
|
||||
"${SRC_DIR}/android/android_import.c"
|
||||
"${SRC_DIR}/android/android_share.c"
|
||||
"${SRC_DIR}/tabs/history_tab.c"
|
||||
"${SRC_DIR}/tabs/language_tab.c"
|
||||
@@ -80,6 +88,7 @@ target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}/android"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
"${LIBINBE_DIR}"
|
||||
"${FLINT_DIR}/include"
|
||||
)
|
||||
|
||||
target_compile_definitions(main PRIVATE
|
||||
@@ -111,6 +120,7 @@ target_link_options(main PRIVATE
|
||||
target_link_libraries(main
|
||||
raylib
|
||||
inbe
|
||||
flint
|
||||
android
|
||||
log
|
||||
OpenSLES
|
||||
|
||||
@@ -2,7 +2,9 @@ package xyz.waozi.inbe;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Insets;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
@@ -11,9 +13,14 @@ import android.view.DisplayCutout;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class MainActivity extends NativeActivity {
|
||||
private static final String TAG = "InbeMainActivity";
|
||||
private static final int REQUEST_IMPORT_ZIP = 1001;
|
||||
|
||||
static {
|
||||
System.loadLibrary("main");
|
||||
@@ -32,6 +39,72 @@ public class MainActivity extends NativeActivity {
|
||||
private native int nativeGetPlayInBackground();
|
||||
private native void nativePauseSession();
|
||||
private native void nativeResumeSession();
|
||||
private native void nativeImportSelectedFile(String path);
|
||||
private native void nativeImportCancelled();
|
||||
|
||||
public void openImportPicker() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] {
|
||||
"application/zip",
|
||||
"application/octet-stream",
|
||||
"application/x-zip-compressed"
|
||||
});
|
||||
startActivityForResult(intent, REQUEST_IMPORT_ZIP);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to open import picker", e);
|
||||
nativeImportCancelled();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode != REQUEST_IMPORT_ZIP) return;
|
||||
|
||||
if (resultCode != RESULT_OK || data == null || data.getData() == null) {
|
||||
nativeImportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = data.getData();
|
||||
File importDir = new File(getCacheDir(), "imports");
|
||||
File importFile = new File(importDir, "inbe-import.zip");
|
||||
|
||||
try {
|
||||
if (!importDir.exists() && !importDir.mkdirs()) {
|
||||
nativeImportSelectedFile("");
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream input = getContentResolver().openInputStream(uri);
|
||||
FileOutputStream output = new FileOutputStream(importFile)) {
|
||||
if (input == null) {
|
||||
nativeImportSelectedFile("");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
}
|
||||
|
||||
nativeImportSelectedFile(importFile.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to import selected file", e);
|
||||
nativeImportSelectedFile("");
|
||||
}
|
||||
}
|
||||
|
||||
public void acquireWakeLock() {
|
||||
Log.d(TAG, "acquireWakeLock called - wakeLock=" + wakeLock);
|
||||
@@ -61,6 +134,26 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void keepScreenOn() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Log.d(TAG, "Screen lock timeout disabled for active session");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void allowScreenOff() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
Log.d(TAG, "Screen lock timeout restored");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -239,6 +332,7 @@ public class MainActivity extends NativeActivity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.d(TAG, "onDestroy called - releasing wake lock");
|
||||
allowScreenOff();
|
||||
releaseWakeLock();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
### Added
|
||||
- Flint-based UI and theme system
|
||||
- Session volume slider with immediate persistence
|
||||
- Additional language support: Czech (Čeština), Indonesian (Bahasa Indonesia), Japanese (日本語), Korean (한국어), and Chinese (中文)
|
||||
- Proper font glyphs
|
||||
@@ -0,0 +1,2 @@
|
||||
### Added
|
||||
- Breath hold display mode setting with circle progress or stopwatch display
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Android touch targets now align correctly on devices with navigation bar window insets.
|
||||
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 153 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 192 B |
|
Before Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 157 B |
@@ -1,6 +1,5 @@
|
||||
# Inbe app configuration
|
||||
name "inbe"
|
||||
title "Inner Breeze"
|
||||
icon "icons/inbe.png"
|
||||
width 320
|
||||
height 560
|
||||
@@ -23,10 +23,10 @@
|
||||
<meta name="twitter:site" content="@waozixyz">
|
||||
<meta name="twitter:creator" content="@waozixyz">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="icons/icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="icons/icon-512x512.png">
|
||||
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="web-assets/icons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="web-assets/icons/icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="web-assets/icons/icon-512x512.png">
|
||||
<link rel="apple-touch-icon" href="web-assets/icons/apple-touch-icon.png">
|
||||
<meta name="theme-color" content="#5566aa">
|
||||
|
||||
<!-- JSON-LD Structured Data -->
|
||||
@@ -75,30 +75,30 @@
|
||||
<div class="content">
|
||||
<main id="main-content">
|
||||
<section class="hero" aria-label="App introduction and download options">
|
||||
<img class="tk-img" src="/icons/inbe.png" width="128px" alt="Inner Breeze app logo - a calming blue wind spiral icon"/>
|
||||
<img class="tk-img" src="/web-assets/icons/inbe.png" width="128px" alt="Inner Breeze app logo - a calming blue wind spiral icon"/>
|
||||
|
||||
<h1>Inner Breeze</h1>
|
||||
<p>guided breathing meditation based on the Wim Hof method</p>
|
||||
<p class="version">1.1.9</p>
|
||||
<p class="version">1.2.2</p>
|
||||
|
||||
<!-- Direct Downloads -->
|
||||
<nav aria-label="Platform downloads" class="platform-buttons">
|
||||
<a href="/build/web/index.html" class="platform-btn web">
|
||||
<img src="/icons/wasm.png" alt="WebAssembly icon"/>
|
||||
<img src="/web-assets/icons/wasm.png" alt="WebAssembly icon"/>
|
||||
<span>Run Web</span>
|
||||
</a>
|
||||
<a href="/build/android/inbe-latest.apk" class="platform-btn android">
|
||||
<img src="/icons/droid.png" alt="Android icon"/>
|
||||
<img src="/web-assets/icons/droid.png" alt="Android icon"/>
|
||||
<span>Android</span>
|
||||
|
||||
</a>
|
||||
<a href="/build/windows/inbe-windows.zip" class="platform-btn windows">
|
||||
<img src="/icons/win.png" alt="Windows icon"/>
|
||||
<img src="/web-assets/icons/win.png" alt="Windows icon"/>
|
||||
<span>Windows</span>
|
||||
|
||||
</a>
|
||||
<a href="/build/linux/inbe-linux.tar.gz" class="platform-btn linux">
|
||||
<img src="/icons/tux.png" alt="Linux icon"/>
|
||||
<img src="/web-assets/icons/tux.png" alt="Linux icon"/>
|
||||
<span>Linux</span>
|
||||
|
||||
</a>
|
||||
@@ -107,15 +107,15 @@
|
||||
<!-- App Stores -->
|
||||
<nav aria-label="App store downloads" class="platform-buttons">
|
||||
<a href="https://play.google.com/store/apps/details?id=xyz.waozi.inbe" class="platform-btn android">
|
||||
<img src="/icons/playstore.png" alt="Play Store icon"/>
|
||||
<img src="/web-assets/icons/playstore.png" alt="Play Store icon"/>
|
||||
<span>Play Store</span>
|
||||
</a>
|
||||
<a href="https://f-droid.org/packages/xyz.waozi.inbe/" class="platform-btn android">
|
||||
<img src="/icons/fdroid.png" alt="F-Droid icon"/>
|
||||
<img src="/web-assets/icons/fdroid.png" alt="F-Droid icon"/>
|
||||
<span>F-Droid</span>
|
||||
</a>
|
||||
<a href="https://waozi.itch.io/inbe" class="platform-btn web">
|
||||
<img src="/icons/itch.png" alt="itch.io icon"/>
|
||||
<img src="/web-assets/icons/itch.png" alt="itch.io icon"/>
|
||||
<span>itch.io</span>
|
||||
</a>
|
||||
</nav>
|
||||
@@ -154,6 +154,12 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="migration-section">
|
||||
<h2>Migrating from inbe-legacy?</h2>
|
||||
<p>Use the web converter to turn an inbe-legacy JSON export into the ZIP format used by current Inner Breeze imports.</p>
|
||||
<p><a href="/legacy-converter.html">Open legacy data converter</a></p>
|
||||
</section>
|
||||
|
||||
<!-- About Section -->
|
||||
<section class="about-section">
|
||||
<h2>About the Wim Hof Method</h2>
|
||||
@@ -172,7 +178,7 @@
|
||||
<section class="info-section">
|
||||
<nav aria-label="Source code" class="platform-buttons">
|
||||
<a href="https://github.com/waozixyz/inbe" target="_blank" rel="noopener" class="platform-btn web">
|
||||
<img src="/icons/github.png" alt="GitHub icon"/>
|
||||
<img src="/web-assets/icons/github.png" alt="GitHub icon"/>
|
||||
<span>GitHub</span>
|
||||
</a>
|
||||
</nav>
|
||||
@@ -195,4 +201,4 @@
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -0,0 +1,287 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8" />
|
||||
<head>
|
||||
<title>Inner Breeze Legacy Data Converter</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Convert inbe-legacy JSON exports into the current Inner Breeze import ZIP format.">
|
||||
<link rel="canonical" href="https://inbe.waozi.xyz/legacy-converter.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<main id="main-content">
|
||||
<section class="tool-section">
|
||||
<h1>Legacy Data Converter</h1>
|
||||
<p>Coming from inbe-legacy? Convert the old JSON export into the ZIP file used by the current Inner Breeze import tool.</p>
|
||||
<p class="safety-note"><em>This runs entirely in your browser. Your file is not uploaded.</em></p>
|
||||
|
||||
<div class="converter-panel">
|
||||
<label for="legacy-file">inbe-legacy JSON export</label>
|
||||
<input id="legacy-file" type="file" accept=".json,application/json">
|
||||
<button id="convert-button" type="button">Convert to Inbe ZIP</button>
|
||||
<p id="converter-status" class="converter-status" role="status">Choose an inbe-legacy JSON export.</p>
|
||||
</div>
|
||||
|
||||
<p><a href="/">Back to downloads</a></p>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<p>© 2026 <a href="https://waozi.xyz">Waozi</a> | <a href="/privacy.html">Privacy Policy</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
var fileInput = document.getElementById("legacy-file");
|
||||
var convertButton = document.getElementById("convert-button");
|
||||
var statusEl = document.getElementById("converter-status");
|
||||
|
||||
function setStatus(message, isError) {
|
||||
statusEl.textContent = message;
|
||||
statusEl.className = isError ? "converter-status error" : "converter-status";
|
||||
}
|
||||
|
||||
function pad(value, width) {
|
||||
var text = String(value);
|
||||
while(text.length < width) text = "0" + text;
|
||||
return text;
|
||||
}
|
||||
|
||||
function dosDateTime(date) {
|
||||
var year = date.getFullYear();
|
||||
if(year < 1980) year = 1980;
|
||||
return {
|
||||
time: (date.getHours() << 11) | (date.getMinutes() << 5) | Math.floor(date.getSeconds() / 2),
|
||||
date: ((year - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate()
|
||||
};
|
||||
}
|
||||
|
||||
var crcTable = null;
|
||||
function makeCrcTable() {
|
||||
var table = [];
|
||||
for(var n = 0; n < 256; n++) {
|
||||
var c = n;
|
||||
for(var k = 0; k < 8; k++) {
|
||||
c = (c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1);
|
||||
}
|
||||
table[n] = c >>> 0;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
function crc32(bytes) {
|
||||
if(crcTable === null) crcTable = makeCrcTable();
|
||||
var crc = 0 ^ -1;
|
||||
for(var i = 0; i < bytes.length; i++) {
|
||||
crc = (crc >>> 8) ^ crcTable[(crc ^ bytes[i]) & 0xff];
|
||||
}
|
||||
return (crc ^ -1) >>> 0;
|
||||
}
|
||||
|
||||
function writeU16(out, value) {
|
||||
out.push(value & 255, (value >>> 8) & 255);
|
||||
}
|
||||
|
||||
function writeU32(out, value) {
|
||||
out.push(value & 255, (value >>> 8) & 255, (value >>> 16) & 255, (value >>> 24) & 255);
|
||||
}
|
||||
|
||||
function appendBytes(out, bytes) {
|
||||
for(var i = 0; i < bytes.length; i++) out.push(bytes[i]);
|
||||
}
|
||||
|
||||
function makeZip(files) {
|
||||
var encoder = new TextEncoder();
|
||||
var out = [];
|
||||
var central = [];
|
||||
var now = dosDateTime(new Date());
|
||||
|
||||
files.forEach(function(file) {
|
||||
var nameBytes = encoder.encode(file.name);
|
||||
var dataBytes = encoder.encode(file.content);
|
||||
var crc = crc32(dataBytes);
|
||||
var offset = out.length;
|
||||
|
||||
writeU32(out, 0x04034b50);
|
||||
writeU16(out, 20);
|
||||
writeU16(out, 0);
|
||||
writeU16(out, 0);
|
||||
writeU16(out, now.time);
|
||||
writeU16(out, now.date);
|
||||
writeU32(out, crc);
|
||||
writeU32(out, dataBytes.length);
|
||||
writeU32(out, dataBytes.length);
|
||||
writeU16(out, nameBytes.length);
|
||||
writeU16(out, 0);
|
||||
appendBytes(out, nameBytes);
|
||||
appendBytes(out, dataBytes);
|
||||
|
||||
writeU32(central, 0x02014b50);
|
||||
writeU16(central, 20);
|
||||
writeU16(central, 20);
|
||||
writeU16(central, 0);
|
||||
writeU16(central, 0);
|
||||
writeU16(central, now.time);
|
||||
writeU16(central, now.date);
|
||||
writeU32(central, crc);
|
||||
writeU32(central, dataBytes.length);
|
||||
writeU32(central, dataBytes.length);
|
||||
writeU16(central, nameBytes.length);
|
||||
writeU16(central, 0);
|
||||
writeU16(central, 0);
|
||||
writeU16(central, 0);
|
||||
writeU16(central, 0);
|
||||
writeU32(central, 0);
|
||||
writeU32(central, offset);
|
||||
appendBytes(central, nameBytes);
|
||||
});
|
||||
|
||||
var centralOffset = out.length;
|
||||
appendBytes(out, central);
|
||||
writeU32(out, 0x06054b50);
|
||||
writeU16(out, 0);
|
||||
writeU16(out, 0);
|
||||
writeU16(out, files.length);
|
||||
writeU16(out, files.length);
|
||||
writeU32(out, central.length);
|
||||
writeU32(out, centralOffset);
|
||||
writeU16(out, 0);
|
||||
|
||||
return new Blob([new Uint8Array(out)], {type: "application/zip"});
|
||||
}
|
||||
|
||||
function sessionDate(session) {
|
||||
var id = session && session.id;
|
||||
var dateTime = session && session.dateTime;
|
||||
var numeric = Number(id);
|
||||
var date;
|
||||
|
||||
if(Number.isFinite(numeric) && numeric > 0) {
|
||||
date = new Date(numeric);
|
||||
} else if(typeof id === "string") {
|
||||
date = new Date(id);
|
||||
}
|
||||
|
||||
if((!date || Number.isNaN(date.getTime())) && typeof dateTime === "string") {
|
||||
date = new Date(dateTime);
|
||||
}
|
||||
|
||||
if(!date || Number.isNaN(date.getTime())) {
|
||||
return null;
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
function roundSeconds(value) {
|
||||
var number = Number(value);
|
||||
if(!Number.isFinite(number) || number <= 0) return 0;
|
||||
if(number > 999) number = Math.round(number / 1000);
|
||||
else number = Math.round(number);
|
||||
if(number < 1 || number > 999) return 0;
|
||||
return number;
|
||||
}
|
||||
|
||||
function convertLegacy(data) {
|
||||
var sessions = Array.isArray(data) ? data : data.sessions;
|
||||
var files = [];
|
||||
var usedPaths = {};
|
||||
|
||||
if(!Array.isArray(sessions)) {
|
||||
throw new Error("No sessions array found in the legacy export.");
|
||||
}
|
||||
|
||||
sessions.forEach(function(session) {
|
||||
var date = sessionDate(session);
|
||||
var rounds = session && session.rounds;
|
||||
var seconds = [];
|
||||
var path;
|
||||
|
||||
if(!date || !rounds || typeof rounds !== "object") return;
|
||||
|
||||
Object.keys(rounds).sort(function(a, b) {
|
||||
return Number(a) - Number(b);
|
||||
}).forEach(function(key) {
|
||||
var value = roundSeconds(rounds[key]);
|
||||
if(value > 0) seconds.push(value);
|
||||
});
|
||||
|
||||
if(seconds.length === 0) return;
|
||||
|
||||
path = "lotus-data/sessions/" +
|
||||
pad(date.getFullYear(), 4) + "/" +
|
||||
pad(date.getMonth() + 1, 2) + "/" +
|
||||
pad(date.getDate(), 2) + "/inbe-" +
|
||||
pad(date.getHours(), 2) +
|
||||
pad(date.getMinutes(), 2) +
|
||||
pad(date.getSeconds(), 2);
|
||||
|
||||
while(usedPaths[path]) {
|
||||
date = new Date(date.getTime() + 1000);
|
||||
path = "lotus-data/sessions/" +
|
||||
pad(date.getFullYear(), 4) + "/" +
|
||||
pad(date.getMonth() + 1, 2) + "/" +
|
||||
pad(date.getDate(), 2) + "/inbe-" +
|
||||
pad(date.getHours(), 2) +
|
||||
pad(date.getMinutes(), 2) +
|
||||
pad(date.getSeconds(), 2);
|
||||
}
|
||||
usedPaths[path] = true;
|
||||
|
||||
files.push({
|
||||
name: path,
|
||||
content: seconds.join("\n") + "\n"
|
||||
});
|
||||
});
|
||||
|
||||
if(files.length === 0) {
|
||||
throw new Error("No valid legacy sessions were found.");
|
||||
}
|
||||
|
||||
files.unshift({
|
||||
name: "lotus-data/metadata.txt",
|
||||
content: "Inner Breeze Data Export\nVersion: legacy-converter\nDate: " + new Date().toISOString() + "\nSessions: " + files.length + "\n"
|
||||
});
|
||||
|
||||
return {
|
||||
count: files.length - 1,
|
||||
blob: makeZip(files)
|
||||
};
|
||||
}
|
||||
|
||||
function downloadBlob(blob, filename) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
var link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
setTimeout(function() {
|
||||
URL.revokeObjectURL(url);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
convertButton.addEventListener("click", function() {
|
||||
var file = fileInput.files && fileInput.files[0];
|
||||
if(!file) {
|
||||
setStatus("Choose a legacy JSON export first.", true);
|
||||
return;
|
||||
}
|
||||
|
||||
file.text().then(function(text) {
|
||||
var data = JSON.parse(text);
|
||||
var result = convertLegacy(data);
|
||||
downloadBlob(result.blob, "inbe-legacy-converted.zip");
|
||||
setStatus("Converted " + result.count + " sessions. Import the downloaded ZIP in Inner Breeze.", false);
|
||||
}).catch(function(error) {
|
||||
setStatus(error.message || "Conversion failed.", true);
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -18,12 +18,12 @@ count_value(const char v[CountSize])
|
||||
int
|
||||
inbe_breath_half_ticks_for_speed(int speed)
|
||||
{
|
||||
static const int breath_half_ticks[] = {108, 100, 93, 86, 80, 74, 68, 63, 58, 53, 48, 42, 36, 30, 24, 18};
|
||||
static const int breath_half_ticks[] = {132, 120, 108, 100, 93, 86, 80, 74, 68, 63, 58, 53};
|
||||
|
||||
if(speed < 1)
|
||||
speed = 1;
|
||||
if(speed > 16)
|
||||
speed = 16;
|
||||
if(speed > 12)
|
||||
speed = 12;
|
||||
|
||||
return breath_half_ticks[speed - 1];
|
||||
}
|
||||
@@ -90,6 +90,7 @@ inbeinit(Inbe *l)
|
||||
l->max_rounds = DefaultMaxRounds;
|
||||
l->pause_seconds = DefaultPauseSeconds;
|
||||
l->progressive_speed = 1;
|
||||
l->progressive_start_speed = 3;
|
||||
#ifdef __ANDROID__
|
||||
l->play_in_background = 1; // Enabled by default on Android
|
||||
#else
|
||||
@@ -122,20 +123,26 @@ static int
|
||||
effective_breath_half_ticks(const Inbe *l)
|
||||
{
|
||||
int target_ticks = inbe_breath_half_ticks_for_speed(l->speed_level);
|
||||
int start_speed = l->progressive_start_speed;
|
||||
|
||||
if(!l->progressive_speed || l->round != 0)
|
||||
return target_ticks;
|
||||
|
||||
if(start_speed < 1)
|
||||
start_speed = 1;
|
||||
if(start_speed > l->speed_level)
|
||||
start_speed = l->speed_level;
|
||||
|
||||
int completed_breaths = count_value(l->count);
|
||||
|
||||
if(completed_breaths < 5)
|
||||
return inbe_breath_half_ticks_for_speed(1);
|
||||
return inbe_breath_half_ticks_for_speed(start_speed);
|
||||
|
||||
if(completed_breaths >= 10)
|
||||
return target_ticks;
|
||||
|
||||
return lerp_int(
|
||||
inbe_breath_half_ticks_for_speed(1),
|
||||
inbe_breath_half_ticks_for_speed(start_speed),
|
||||
target_ticks,
|
||||
completed_breaths - 4,
|
||||
5
|
||||
|
||||
@@ -68,6 +68,7 @@ struct Inbe {
|
||||
int pause_seconds;
|
||||
int play_in_background;
|
||||
int progressive_speed;
|
||||
int progressive_start_speed;
|
||||
|
||||
char count[CountSize];
|
||||
char maxbreaths[CountSize];
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
[app_title]
|
||||
Inner Breeze
|
||||
---
|
||||
[tab_history]
|
||||
Historie
|
||||
---
|
||||
[tab_manual]
|
||||
Návod
|
||||
---
|
||||
[tab_settings]
|
||||
Nastavení
|
||||
---
|
||||
[play_button]
|
||||
SPUSTIT
|
||||
---
|
||||
[breath_button]
|
||||
DÝCHAT
|
||||
---
|
||||
[results_title]
|
||||
VÝSLEDKY
|
||||
---
|
||||
[home_button]
|
||||
DOMŮ
|
||||
---
|
||||
[exit_session_title]
|
||||
Ukončit sezení?
|
||||
---
|
||||
[save_completed_rounds_message]
|
||||
Uložit dokončená kola před ukončením?
|
||||
---
|
||||
[cancel_button]
|
||||
Zrušit
|
||||
---
|
||||
[save_button]
|
||||
Uložit
|
||||
---
|
||||
[save_results_button]
|
||||
Uložit
|
||||
---
|
||||
[discard_button]
|
||||
Zahodit
|
||||
---
|
||||
[all_progress_lost_message]
|
||||
Veškerý postup bude ztracen.
|
||||
---
|
||||
[exit_button]
|
||||
Ukončit
|
||||
---
|
||||
[round_times_title]
|
||||
Časy kol
|
||||
---
|
||||
[results_rounds]
|
||||
%d kol
|
||||
---
|
||||
[results_best]
|
||||
nejlépe %ds
|
||||
---
|
||||
[results_avg]
|
||||
průměr %ds
|
||||
---
|
||||
[round_result_label]
|
||||
Kolo %d %ds
|
||||
---
|
||||
[starting_in]
|
||||
ZAČÍNÁ ZA %2d
|
||||
---
|
||||
[settings_title]
|
||||
Nastavení
|
||||
---
|
||||
[settings_tab_breathing]
|
||||
Dýchání
|
||||
---
|
||||
[settings_tab_session]
|
||||
Sezení
|
||||
---
|
||||
[settings_tab_sound]
|
||||
Zvuk
|
||||
---
|
||||
[settings_tab_appearance]
|
||||
Vzhled
|
||||
---
|
||||
[settings_tab_language]
|
||||
Jazyk
|
||||
---
|
||||
[settings_tab_data]
|
||||
Data
|
||||
---
|
||||
[settings_tab_about]
|
||||
O aplikaci
|
||||
---
|
||||
[settings_category_practice]
|
||||
Nastavení cvičení
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
Nastavte dýchání a sezení
|
||||
---
|
||||
[settings_category_app]
|
||||
Předvolby aplikace
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
Přizpůsobte vzhled a zvuk
|
||||
---
|
||||
[settings_category_about_data]
|
||||
O aplikaci a data
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
Zobrazte informace a spravujte data
|
||||
---
|
||||
[theme_label]
|
||||
Motiv
|
||||
---
|
||||
[speed_label]
|
||||
Rychlost
|
||||
---
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Přehrávat na pozadí
|
||||
---
|
||||
[max_rounds_label]
|
||||
Max. kol
|
||||
---
|
||||
[max_breaths_label]
|
||||
Max. nádechů
|
||||
---
|
||||
[pause_after_round_label]
|
||||
Pauza po kole
|
||||
---
|
||||
[advanced_session_controls_label]
|
||||
Pokročilé ovládání sezení
|
||||
---
|
||||
[hold_display_label]
|
||||
Zobrazeni zadrze
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Stopky
|
||||
---
|
||||
[hold_display_circle]
|
||||
Kruh
|
||||
---
|
||||
[volume_label]
|
||||
Hlasitost
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
Obnovit výchozí
|
||||
---
|
||||
[fullscreen_label]
|
||||
Celá obrazovka
|
||||
---
|
||||
[language_label]
|
||||
Jazyk
|
||||
---
|
||||
[language_picker_title]
|
||||
Vyberte jazyk
|
||||
---
|
||||
[next_button]
|
||||
Další
|
||||
---
|
||||
[coming_soon_label]
|
||||
Brzy...
|
||||
---
|
||||
[data_management_label]
|
||||
Správa dat
|
||||
---
|
||||
[total_sessions_label]
|
||||
Celkem sezení: %d
|
||||
---
|
||||
[data_size_label]
|
||||
Velikost dat: %s
|
||||
---
|
||||
[storage_label]
|
||||
Úložiště: %s
|
||||
---
|
||||
[export_data_button]
|
||||
Exportovat data
|
||||
---
|
||||
[delete_all_data_button]
|
||||
Smazat všechna data
|
||||
---
|
||||
[export_data_dialog_title]
|
||||
Exportovat data
|
||||
---
|
||||
[export_failed]
|
||||
Export selhal
|
||||
---
|
||||
[exported_label]
|
||||
Exportováno
|
||||
---
|
||||
[import_data_button]
|
||||
Importovat data
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Importovat data
|
||||
---
|
||||
[import_failed]
|
||||
Import selhal
|
||||
---
|
||||
[imported_sessions]
|
||||
Importováno %d sezení
|
||||
---
|
||||
[import_invalid_file]
|
||||
Neplatný exportní soubor
|
||||
---
|
||||
[import_cancelled]
|
||||
Import zrušen
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Verze %s
|
||||
---
|
||||
[about_description]
|
||||
Inner Breeze je jednoduchá aplikace
|
||||
pro dechovou meditaci, která vám pomůže
|
||||
uvolnit se a najít klid.
|
||||
---
|
||||
[toggle_off]
|
||||
VYP
|
||||
---
|
||||
[toggle_on]
|
||||
ZAP
|
||||
---
|
||||
[theme_light]
|
||||
Světlý
|
||||
---
|
||||
[theme_dark]
|
||||
Tmavý
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Klávesnice na obrazovce
|
||||
---
|
||||
[history_title]
|
||||
Historie
|
||||
---
|
||||
[history_empty]
|
||||
Zatím nejsou uložena žádná sezení.
|
||||
Dokončete sezení a přidejte data.
|
||||
---
|
||||
[history_month_label]
|
||||
Měsíc %02d
|
||||
---
|
||||
[history_day_label]
|
||||
Den %02d
|
||||
---
|
||||
[history_round_short_label]
|
||||
K%d
|
||||
---
|
||||
[history_round_label]
|
||||
K%d %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d průměr %ds
|
||||
---
|
||||
[tutorial_title]
|
||||
Návod
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Metoda
|
||||
---
|
||||
[tutorial_step1_title]
|
||||
Krok 1: Nádech a výdech
|
||||
---
|
||||
[tutorial_step2_title]
|
||||
Krok 2: Výdech a zádrž
|
||||
---
|
||||
[tutorial_step3_title]
|
||||
Krok 3: Nádech a zádrž
|
||||
---
|
||||
[tutorial_progressive_speed_title]
|
||||
Postupná rychlost
|
||||
---
|
||||
[tutorial_step_intro]
|
||||
Toto dechové cvičení vychází z Wim Hofovy metody.
|
||||
|
||||
Může být silné. Používejte ho opatrně.
|
||||
|
||||
Cvičte vsedě nebo vleže.
|
||||
Nikdy ho nepoužívejte při řízení,
|
||||
vestoje ani ve vodě.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
Stačí postupovat ve 4 krocích:
|
||||
|
||||
1. Dýchejte rytmicky.
|
||||
2. Vydechněte a zadržte dech.
|
||||
3. Zhluboka se nadechněte a zadržte dech.
|
||||
4. Vydechněte a opakujte.
|
||||
|
||||
Pomocí ikony ozubeného kola %i upravíte kola, nádechy, rychlost a pauzy.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
Naplňte plíce úplně a potom nechte dech volně odejít.
|
||||
|
||||
Tímto posuvníkem nastavíte tempo dechového kruhu.
|
||||
|
||||
Najděte rytmus, který vám připadá přirozený.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
Postupná rychlost usnadňuje vstup do prvního kola.
|
||||
|
||||
Když je zapnutá, první kolo začne rychlostí 1 pro prvních 5 nádechů a potom se postupně zvýší na vámi vybranou rychlost.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
Po dechovém kole
|
||||
normálně vydechněte a zadržte dech.
|
||||
|
||||
Uvolněte se, až si tělo řekne
|
||||
o vzduch. Nenuťte to.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Plně se nadechněte a zadržte dech asi na 15 sekund.
|
||||
|
||||
Potom vydechněte a začněte další kolo.
|
||||
Časem může každé kolo působit hlouběji.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
PŘESKOČIT
|
||||
---
|
||||
[tutorial_back_button]
|
||||
ZPĚT
|
||||
---
|
||||
[tutorial_next_button]
|
||||
DALŠÍ
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
DOKONČIT
|
||||
---
|
||||
[share_sheet_title]
|
||||
Export dat sezení
|
||||
---
|
||||
[export_metadata_header]
|
||||
Export dat Inner Breeze
|
||||
---
|
||||
[export_metadata_version]
|
||||
Verze: %s
|
||||
---
|
||||
[export_metadata_date]
|
||||
Datum exportu: %s
|
||||
---
|
||||
[export_metadata_count]
|
||||
Počet sezení: %d
|
||||
---
|
||||
[delete_history_title]
|
||||
Smazat?
|
||||
---
|
||||
[delete_session_message]
|
||||
Smazat toto sezení? Tuto akci nelze vrátit.
|
||||
---
|
||||
[delete_round_message]
|
||||
Smazat toto kolo? Tuto akci nelze vrátit.
|
||||
---
|
||||
[delete_button]
|
||||
Smazat
|
||||
---
|
||||
@@ -94,8 +94,8 @@ Thema
|
||||
[speed_label]
|
||||
Geschwindigkeit
|
||||
---
|
||||
[progressive_speed_label]
|
||||
Progressive Geschwindigkeit
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Im Hintergrund abspielen
|
||||
@@ -112,6 +112,15 @@ Pause nach Runde
|
||||
[advanced_session_controls_label]
|
||||
Erweiterte Sitzungssteuerung
|
||||
---
|
||||
[hold_display_label]
|
||||
Atemhalteanzeige
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Stoppuhr
|
||||
---
|
||||
[hold_display_circle]
|
||||
Kreis
|
||||
---
|
||||
[volume_label]
|
||||
Lautstärke
|
||||
---
|
||||
@@ -158,7 +167,46 @@ Daten exportieren
|
||||
Export fehlgeschlagen
|
||||
---
|
||||
[exported_label]
|
||||
Exportiert: %s
|
||||
Exportiert
|
||||
---
|
||||
[import_data_button]
|
||||
Daten importieren
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Daten importieren
|
||||
---
|
||||
[import_failed]
|
||||
Import fehlgeschlagen
|
||||
---
|
||||
[imported_sessions]
|
||||
%d Sitzungen importiert
|
||||
---
|
||||
[import_invalid_file]
|
||||
Ungültige Exportdatei
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Version %s
|
||||
@@ -174,6 +222,12 @@ AUS
|
||||
[toggle_on]
|
||||
AN
|
||||
---
|
||||
[theme_light]
|
||||
Hell
|
||||
---
|
||||
[theme_dark]
|
||||
Dunkel
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Bildschirmtastatur
|
||||
---
|
||||
@@ -200,7 +254,10 @@ R%d %ds
|
||||
%02d:%02d durchschn. %ds
|
||||
---
|
||||
[tutorial_title]
|
||||
Tutorial
|
||||
Anleitung
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Methode
|
||||
|
||||
@@ -115,6 +115,9 @@ Speed
|
||||
[progressive_speed_label]
|
||||
Progressive speed
|
||||
---
|
||||
[progressive_start_speed_label]
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Play in background
|
||||
---
|
||||
@@ -130,6 +133,15 @@ Pause after round
|
||||
[advanced_session_controls_label]
|
||||
Advanced session controls
|
||||
---
|
||||
[hold_display_label]
|
||||
Hold display
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Stopwatch
|
||||
---
|
||||
[hold_display_circle]
|
||||
Circle
|
||||
---
|
||||
[volume_label]
|
||||
Volume
|
||||
---
|
||||
@@ -176,7 +188,46 @@ Export Data
|
||||
Export failed
|
||||
---
|
||||
[exported_label]
|
||||
Exported: %s
|
||||
Exported
|
||||
---
|
||||
[import_data_button]
|
||||
Import Data
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Import Data
|
||||
---
|
||||
[import_failed]
|
||||
Import failed
|
||||
---
|
||||
[imported_sessions]
|
||||
Imported %d sessions
|
||||
---
|
||||
[import_invalid_file]
|
||||
Invalid export file
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Version %s
|
||||
@@ -192,6 +243,12 @@ OFF
|
||||
[toggle_on]
|
||||
ON
|
||||
---
|
||||
[theme_light]
|
||||
Light
|
||||
---
|
||||
[theme_dark]
|
||||
Dark
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
On-screen keyboard
|
||||
---
|
||||
@@ -220,6 +277,9 @@ R%d %ds
|
||||
[tutorial_title]
|
||||
Tutorial
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Method
|
||||
---
|
||||
@@ -264,14 +324,14 @@ Find a rhythm that feels natural for you.
|
||||
[tutorial_step_progressive_speed]
|
||||
Progressive speed makes the first round easier to enter.
|
||||
|
||||
When it is on, the first round starts at speed 1 for the first 5 breaths, then gradually increases to your selected speed.
|
||||
When it is on, the first round starts slower, then gradually increases to your selected speed.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
After the breathing round,
|
||||
exhale normally and hold.
|
||||
Exhale normally and hold.
|
||||
|
||||
Release when your body asks
|
||||
for air. Do not force it.
|
||||
The center number keeps counting. Circle mode adds layered progress lines.
|
||||
|
||||
Release when your body asks for air.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Inhale fully and hold for about 15 seconds.
|
||||
|
||||
@@ -94,8 +94,8 @@ Tema
|
||||
[speed_label]
|
||||
Velocidad
|
||||
---
|
||||
[progressive_speed_label]
|
||||
Velocidad progresiva
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Reproducir en segundo plano
|
||||
@@ -112,6 +112,15 @@ Pausa después de ronda
|
||||
[advanced_session_controls_label]
|
||||
Controles avanzados de sesión
|
||||
---
|
||||
[hold_display_label]
|
||||
Visualizacion de retencion
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Cronometro
|
||||
---
|
||||
[hold_display_circle]
|
||||
Circulo
|
||||
---
|
||||
[volume_label]
|
||||
Volumen
|
||||
---
|
||||
@@ -158,7 +167,46 @@ Exportar datos
|
||||
Error al exportar
|
||||
---
|
||||
[exported_label]
|
||||
Exportado: %s
|
||||
Exportado
|
||||
---
|
||||
[import_data_button]
|
||||
Importar datos
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Importar datos
|
||||
---
|
||||
[import_failed]
|
||||
Error al importar
|
||||
---
|
||||
[imported_sessions]
|
||||
%d sesiones importadas
|
||||
---
|
||||
[import_invalid_file]
|
||||
Archivo de exportación no válido
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Versión %s
|
||||
@@ -174,6 +222,12 @@ APAGADO
|
||||
[toggle_on]
|
||||
ENCENDIDO
|
||||
---
|
||||
[theme_light]
|
||||
Claro
|
||||
---
|
||||
[theme_dark]
|
||||
Oscuro
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Teclado en pantalla
|
||||
---
|
||||
@@ -202,6 +256,9 @@ R%d %ds
|
||||
[tutorial_title]
|
||||
Tutorial
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Método
|
||||
---
|
||||
|
||||
@@ -94,8 +94,8 @@ Thème
|
||||
[speed_label]
|
||||
Vitesse
|
||||
---
|
||||
[progressive_speed_label]
|
||||
Vitesse progressive
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Lecture en arrière-plan
|
||||
@@ -112,6 +112,15 @@ Pause après cycle
|
||||
[advanced_session_controls_label]
|
||||
Contrôles avancés de séance
|
||||
---
|
||||
[hold_display_label]
|
||||
Affichage de la retention
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Chronometre
|
||||
---
|
||||
[hold_display_circle]
|
||||
Cercle
|
||||
---
|
||||
[volume_label]
|
||||
Volume
|
||||
---
|
||||
@@ -158,7 +167,46 @@ Exporter les données
|
||||
Échec de l'export
|
||||
---
|
||||
[exported_label]
|
||||
Exporté : %s
|
||||
Exporté
|
||||
---
|
||||
[import_data_button]
|
||||
Importer les données
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Importer les données
|
||||
---
|
||||
[import_failed]
|
||||
Échec de l'import
|
||||
---
|
||||
[imported_sessions]
|
||||
%d sessions importées
|
||||
---
|
||||
[import_invalid_file]
|
||||
Fichier d'export invalide
|
||||
---
|
||||
[import_cancelled]
|
||||
Import annulé
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Version %s
|
||||
@@ -174,6 +222,12 @@ OFF
|
||||
[toggle_on]
|
||||
ON
|
||||
---
|
||||
[theme_light]
|
||||
Clair
|
||||
---
|
||||
[theme_dark]
|
||||
Sombre
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Clavier à l'écran
|
||||
---
|
||||
@@ -202,6 +256,9 @@ C%d %ds
|
||||
[tutorial_title]
|
||||
Tutoriel
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Méthode
|
||||
---
|
||||
|
||||
@@ -0,0 +1,375 @@
|
||||
[app_title]
|
||||
Inner Breeze
|
||||
---
|
||||
[tab_history]
|
||||
Riwayat
|
||||
---
|
||||
[tab_manual]
|
||||
Tutorial
|
||||
---
|
||||
[tab_settings]
|
||||
Pengaturan
|
||||
---
|
||||
[play_button]
|
||||
MULAI
|
||||
---
|
||||
[breath_button]
|
||||
NAFAS
|
||||
---
|
||||
[results_title]
|
||||
HASIL
|
||||
---
|
||||
[home_button]
|
||||
BERANDA
|
||||
---
|
||||
[exit_session_title]
|
||||
Keluar Sesi?
|
||||
---
|
||||
[save_completed_rounds_message]
|
||||
Simpan ronde yang selesai sebelum keluar?
|
||||
---
|
||||
[cancel_button]
|
||||
Batal
|
||||
---
|
||||
[save_button]
|
||||
Simpan
|
||||
---
|
||||
[save_results_button]
|
||||
Simpan
|
||||
---
|
||||
[discard_button]
|
||||
Buang
|
||||
---
|
||||
[all_progress_lost_message]
|
||||
Semua kemajuan akan hilang.
|
||||
---
|
||||
[exit_button]
|
||||
Keluar
|
||||
---
|
||||
[round_times_title]
|
||||
Waktu ronde
|
||||
---
|
||||
[results_rounds]
|
||||
%d ronde
|
||||
---
|
||||
[results_best]
|
||||
terbaik %ds
|
||||
---
|
||||
[results_avg]
|
||||
rata %ds
|
||||
---
|
||||
[round_result_label]
|
||||
Ronde %d %ds
|
||||
---
|
||||
[starting_in]
|
||||
MULAI DALAM %2d
|
||||
---
|
||||
[settings_title]
|
||||
Pengaturan
|
||||
---
|
||||
[settings_tab_breathing]
|
||||
Pernapasan
|
||||
---
|
||||
[settings_tab_session]
|
||||
Sesi
|
||||
---
|
||||
[settings_tab_sound]
|
||||
Suara
|
||||
---
|
||||
[settings_tab_appearance]
|
||||
Tampilan
|
||||
---
|
||||
[settings_tab_language]
|
||||
Bahasa
|
||||
---
|
||||
[settings_tab_data]
|
||||
Data
|
||||
---
|
||||
[settings_tab_about]
|
||||
Tentang
|
||||
---
|
||||
[settings_category_practice]
|
||||
Pengaturan Latihan
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
Konfigurasi pernapasan dan sesi
|
||||
---
|
||||
[settings_category_app]
|
||||
Preferensi Aplikasi
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
Kustomisasi tampilan dan audio
|
||||
---
|
||||
[settings_category_about_data]
|
||||
Tentang & Data
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
Lihat info dan kelola data
|
||||
---
|
||||
[theme_label]
|
||||
Tema
|
||||
---
|
||||
[speed_label]
|
||||
Kecepatan
|
||||
---
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Putar di latar belakang
|
||||
---
|
||||
[max_rounds_label]
|
||||
Ronde maksimum
|
||||
---
|
||||
[max_breaths_label]
|
||||
Nafas maksimum
|
||||
---
|
||||
[pause_after_round_label]
|
||||
Jeda setelah ronde
|
||||
---
|
||||
[advanced_session_controls_label]
|
||||
Kontrol sesi lanjutan
|
||||
---
|
||||
[hold_display_label]
|
||||
Tampilan tahan napas
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Stopwatch
|
||||
---
|
||||
[hold_display_circle]
|
||||
Lingkaran
|
||||
---
|
||||
[volume_label]
|
||||
Volume
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
Reset ke default
|
||||
---
|
||||
[fullscreen_label]
|
||||
Layar penuh
|
||||
---
|
||||
[language_label]
|
||||
Bahasa
|
||||
---
|
||||
[language_picker_title]
|
||||
Pilih Bahasa
|
||||
---
|
||||
[next_button]
|
||||
Lanjut
|
||||
---
|
||||
[coming_soon_label]
|
||||
Segera hadir...
|
||||
---
|
||||
[data_management_label]
|
||||
Manajemen Data
|
||||
---
|
||||
[total_sessions_label]
|
||||
Total Sesi: %d
|
||||
---
|
||||
[data_size_label]
|
||||
Ukuran Data: %s
|
||||
---
|
||||
[storage_label]
|
||||
Penyimpanan: %s
|
||||
---
|
||||
[export_data_button]
|
||||
Ekspor Data
|
||||
---
|
||||
[delete_all_data_button]
|
||||
Hapus Semua Data
|
||||
---
|
||||
[export_data_dialog_title]
|
||||
Ekspor Data
|
||||
---
|
||||
[export_failed]
|
||||
Ekspor gagal
|
||||
---
|
||||
[exported_label]
|
||||
Terekspor
|
||||
---
|
||||
[import_data_button]
|
||||
Impor Data
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Impor Data
|
||||
---
|
||||
[import_failed]
|
||||
Impor gagal
|
||||
---
|
||||
[imported_sessions]
|
||||
Mengimpor %d sesi
|
||||
---
|
||||
[import_invalid_file]
|
||||
File ekspor tidak valid
|
||||
---
|
||||
[import_cancelled]
|
||||
Impor dibatalkan
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Versi %s
|
||||
---
|
||||
[about_description]
|
||||
Inner Breeze adalah aplikasi meditasi pernapasan sederhana untuk membantu Anda rileks dan menemukan ketenangan.
|
||||
---
|
||||
[toggle_off]
|
||||
MATI
|
||||
---
|
||||
[toggle_on]
|
||||
NYALA
|
||||
---
|
||||
[theme_light]
|
||||
Terang
|
||||
---
|
||||
[theme_dark]
|
||||
Gelap
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Keyboard di layar
|
||||
---
|
||||
[history_title]
|
||||
Riwayat
|
||||
---
|
||||
[history_empty]
|
||||
Belum ada sesi yang disimpan.
|
||||
Selesaikan sesi untuk menambah data.
|
||||
---
|
||||
[history_month_label]
|
||||
Bulan %02d
|
||||
---
|
||||
[history_day_label]
|
||||
Hari %02d
|
||||
---
|
||||
[history_round_short_label]
|
||||
R%d
|
||||
---
|
||||
[history_round_label]
|
||||
R%d %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d rata %ds
|
||||
---
|
||||
[tutorial_title]
|
||||
Tutorial
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Metode
|
||||
---
|
||||
[tutorial_step1_title]
|
||||
Langkah 1: Masuk & Keluar
|
||||
---
|
||||
[tutorial_step2_title]
|
||||
Langkah 2: Buang & Tahan
|
||||
---
|
||||
[tutorial_step3_title]
|
||||
Langkah 3: Tarik & Tahan
|
||||
---
|
||||
[tutorial_progressive_speed_title]
|
||||
Kecepatan Progresif
|
||||
---
|
||||
[tutorial_step_intro]
|
||||
Latihan pernapasan ini didasarkan pada Metode Wim Hof.
|
||||
|
||||
Dapat sangat kuat. Gunakan dengan hati-hati.
|
||||
|
||||
Latih sambil duduk atau berbaring.
|
||||
Jangan gunakan saat mengemudi,
|
||||
berdiri, atau di dalam air.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
Ikuti 4 langkah sederhana:
|
||||
|
||||
1. Bernapas secara ritmis.
|
||||
2. Buang napas dan tahan.
|
||||
3. Tarik napas dalam dan tahan.
|
||||
4. Buang napas dan ulangi.
|
||||
|
||||
Gunakan ikon roda gigi %i untuk menyesuaikan ronde, nafas, kecepatan, dan jeda.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
Isi paru-paru Anda sepenuhnya, lalu biarkan napas keluar.
|
||||
|
||||
Gunakan slider ini untuk mengatur kecepatan lingkaran pernapasan.
|
||||
|
||||
Temukan ritme yang terasa alami bagi Anda.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
Kecepatan progresif membuat ronde pertama lebih mudah dimulai.
|
||||
|
||||
Saat aktif, ronde pertama dimulai pada kecepatan 1 untuk 5 nafas pertama, lalu bertambah hingga kecepatan yang dipilih.
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
Setelah ronde pernapasan,
|
||||
buang napas secara normal dan tahan.
|
||||
|
||||
Lepaskan saat tubuh Anda
|
||||
meminta udara. Jangan dipaksa.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
Tarik napas sepenuhnya dan tahan sekitar 15 detik.
|
||||
|
||||
Lalu buang napas dan mulai ronde berikutnya.
|
||||
Seiring waktu, setiap ronde mungkin terasa lebih dalam.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
LEWATI
|
||||
---
|
||||
[tutorial_back_button]
|
||||
KEMBALI
|
||||
---
|
||||
[tutorial_next_button]
|
||||
LANJUT
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
SELESAI
|
||||
---
|
||||
[share_sheet_title]
|
||||
Ekspor Data Sesi
|
||||
---
|
||||
[export_metadata_header]
|
||||
Ekspor Data Inner Breeze
|
||||
---
|
||||
[export_metadata_version]
|
||||
Versi: %s
|
||||
---
|
||||
[export_metadata_date]
|
||||
Tanggal Ekspor: %s
|
||||
---
|
||||
[export_metadata_count]
|
||||
Jumlah Sesi: %d
|
||||
---
|
||||
[delete_history_title]
|
||||
Hapus?
|
||||
---
|
||||
[delete_session_message]
|
||||
Hapus sesi ini? Tidak dapat dibatalkan.
|
||||
---
|
||||
[delete_round_message]
|
||||
Hapus ronde ini? Tidak dapat dibatalkan.
|
||||
---
|
||||
[delete_button]
|
||||
Hapus
|
||||
---
|
||||
@@ -1,5 +1,10 @@
|
||||
en|English
|
||||
de|Deutsch
|
||||
es|Español
|
||||
cs|Čeština
|
||||
de|Deutsch
|
||||
fr|Français
|
||||
id|Bahasa Indonesia
|
||||
pt|Português
|
||||
ja|日本語
|
||||
ko|한국어
|
||||
zh|中文
|
||||
@@ -0,0 +1,370 @@
|
||||
[app_title]
|
||||
インナーブリーズ
|
||||
---
|
||||
[tab_history]
|
||||
履歴
|
||||
---
|
||||
[tab_manual]
|
||||
チュートリアル
|
||||
---
|
||||
[tab_settings]
|
||||
設定
|
||||
---
|
||||
[play_button]
|
||||
開始
|
||||
---
|
||||
[breath_button]
|
||||
呼吸
|
||||
---
|
||||
[results_title]
|
||||
結果
|
||||
---
|
||||
[home_button]
|
||||
ホーム
|
||||
---
|
||||
[exit_session_title]
|
||||
セッションを終了しますか?
|
||||
---
|
||||
[save_completed_rounds_message]
|
||||
完了したラウンドを保存してから終了しますか?
|
||||
---
|
||||
[cancel_button]
|
||||
キャンセル
|
||||
---
|
||||
[save_button]
|
||||
保存
|
||||
---
|
||||
[save_results_button]
|
||||
保存
|
||||
---
|
||||
[discard_button]
|
||||
破棄
|
||||
---
|
||||
[all_progress_lost_message]
|
||||
すべての進捗が失われます。
|
||||
---
|
||||
[exit_button]
|
||||
終了
|
||||
---
|
||||
[round_times_title]
|
||||
ラウンド時間
|
||||
---
|
||||
[results_rounds]
|
||||
%d ラウンド
|
||||
---
|
||||
[results_best]
|
||||
最速 %ds
|
||||
---
|
||||
[results_avg]
|
||||
平均 %ds
|
||||
---
|
||||
[round_result_label]
|
||||
ラウンド %d %ds
|
||||
---
|
||||
[starting_in]
|
||||
開始まで %2d
|
||||
---
|
||||
[settings_title]
|
||||
設定
|
||||
---
|
||||
[settings_tab_breathing]
|
||||
呼吸
|
||||
---
|
||||
[settings_tab_session]
|
||||
セッション
|
||||
---
|
||||
[settings_tab_sound]
|
||||
サウンド
|
||||
---
|
||||
[settings_tab_appearance]
|
||||
外観
|
||||
---
|
||||
[settings_tab_language]
|
||||
言語
|
||||
---
|
||||
[settings_tab_data]
|
||||
データ
|
||||
---
|
||||
[settings_tab_about]
|
||||
情報
|
||||
---
|
||||
[settings_category_practice]
|
||||
呼吸設定
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
呼吸とセッションを調整します
|
||||
---
|
||||
[settings_category_app]
|
||||
アプリ設定
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
外観と音声をカスタマイズします
|
||||
---
|
||||
[settings_category_about_data]
|
||||
情報とデータ
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
情報の表示とデータ管理
|
||||
---
|
||||
[theme_label]
|
||||
テーマ
|
||||
---
|
||||
[speed_label]
|
||||
速度
|
||||
---
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
バックグラウンド再生
|
||||
---
|
||||
[max_rounds_label]
|
||||
最大ラウンド数
|
||||
---
|
||||
[max_breaths_label]
|
||||
最大呼吸回数
|
||||
---
|
||||
[pause_after_round_label]
|
||||
各ラウンド後に一時停止
|
||||
---
|
||||
[advanced_session_controls_label]
|
||||
詳細なセッション設定
|
||||
---
|
||||
[hold_display_label]
|
||||
ホールド表示
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
ストップウォッチ
|
||||
---
|
||||
[hold_display_circle]
|
||||
円
|
||||
---
|
||||
[volume_label]
|
||||
音量
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
デフォルトに戻す
|
||||
---
|
||||
[fullscreen_label]
|
||||
全画面
|
||||
---
|
||||
[language_label]
|
||||
言語
|
||||
---
|
||||
[language_picker_title]
|
||||
言語を選択
|
||||
---
|
||||
[next_button]
|
||||
次へ
|
||||
---
|
||||
[coming_soon_label]
|
||||
近日公開...
|
||||
---
|
||||
[data_management_label]
|
||||
データ管理
|
||||
---
|
||||
[total_sessions_label]
|
||||
総セッション数:%d
|
||||
---
|
||||
[data_size_label]
|
||||
データサイズ:%s
|
||||
---
|
||||
[storage_label]
|
||||
保存先:%s
|
||||
---
|
||||
[export_data_button]
|
||||
データを書き出す
|
||||
---
|
||||
[delete_all_data_button]
|
||||
すべてのデータを削除
|
||||
---
|
||||
[export_data_dialog_title]
|
||||
データを書き出す
|
||||
---
|
||||
[export_failed]
|
||||
書き出しに失敗しました
|
||||
---
|
||||
[exported_label]
|
||||
書き出し済み
|
||||
---
|
||||
[import_data_button]
|
||||
データをインポート
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
データをインポート
|
||||
---
|
||||
[import_failed]
|
||||
インポートに失敗しました
|
||||
---
|
||||
[imported_sessions]
|
||||
%dセッションをインポートしました
|
||||
---
|
||||
[import_invalid_file]
|
||||
無効なエクスポートファイル
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
バージョン %s
|
||||
---
|
||||
[about_description]
|
||||
Inner Breeze は、気持ちを落ち着かせて
|
||||
リラックスするためのシンプルな
|
||||
呼吸瞑想アプリです。
|
||||
---
|
||||
[toggle_off]
|
||||
OFF
|
||||
---
|
||||
[toggle_on]
|
||||
ON
|
||||
---
|
||||
[theme_light]
|
||||
ライト
|
||||
---
|
||||
[theme_dark]
|
||||
ダーク
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
オンスクリーンキーボード
|
||||
---
|
||||
[history_title]
|
||||
履歴
|
||||
---
|
||||
[history_empty]
|
||||
まだ保存されたセッションはありません。
|
||||
セッションを完了するとここに表示されます。
|
||||
---
|
||||
[history_month_label]
|
||||
%02d 月
|
||||
---
|
||||
[history_day_label]
|
||||
%02d 日
|
||||
---
|
||||
[history_round_short_label]
|
||||
R%d
|
||||
---
|
||||
[history_round_label]
|
||||
R%d %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d 平均 %ds
|
||||
---
|
||||
[tutorial_title]
|
||||
チュートリアル
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
方法
|
||||
---
|
||||
[tutorial_step1_title]
|
||||
ステップ 1: 吸って吐く
|
||||
---
|
||||
[tutorial_step2_title]
|
||||
ステップ 2: 吐いて止める
|
||||
---
|
||||
[tutorial_step3_title]
|
||||
ステップ 3: 吸って止める
|
||||
---
|
||||
[tutorial_progressive_speed_title]
|
||||
段階的速度
|
||||
---
|
||||
[tutorial_step_intro]
|
||||
この呼吸法は Wim Hof Method を
|
||||
ベースにしています。
|
||||
|
||||
強く感じることがあります。
|
||||
注意して使ってください。
|
||||
|
||||
座るか横になって行ってください。
|
||||
運転中、
|
||||
立っているとき、水中では行わないでください。
|
||||
---
|
||||
[tutorial_step_method]
|
||||
次の 4 つの手順に従います。
|
||||
|
||||
1. リズミカルに呼吸します。
|
||||
2. 吐いて止めます。
|
||||
3. 深く吸って止めます。
|
||||
4. 吐いて繰り返します。
|
||||
|
||||
歯車アイコン %i でラウンド数、呼吸数、速度、一時停止を調整できます。
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
肺をいっぱいに満たしてから、息を自然に吐き出します。
|
||||
|
||||
このスライダーで呼吸のテンポを設定します。
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
段階的速度は、最初のラウンドに入りやすくします。
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
呼吸ラウンドの後、
|
||||
息を吐いて止めます。
|
||||
|
||||
吸う必要を感じるまで止めます。
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
深く吸って、約 15 秒止めます。
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
スキップ
|
||||
---
|
||||
[tutorial_back_button]
|
||||
戻る
|
||||
---
|
||||
[tutorial_next_button]
|
||||
次へ
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
完了
|
||||
---
|
||||
[share_sheet_title]
|
||||
セッションデータを書き出す
|
||||
---
|
||||
[export_metadata_header]
|
||||
Inner Breeze データ書き出し
|
||||
---
|
||||
[export_metadata_version]
|
||||
バージョン: %s
|
||||
---
|
||||
[export_metadata_date]
|
||||
書き出し日: %s
|
||||
---
|
||||
[export_metadata_count]
|
||||
セッション数: %d
|
||||
---
|
||||
[delete_history_title]
|
||||
削除しますか?
|
||||
---
|
||||
[delete_session_message]
|
||||
このセッションを削除しますか?元に戻せません。
|
||||
---
|
||||
[delete_round_message]
|
||||
このラウンドを削除しますか?元に戻せません。
|
||||
---
|
||||
[delete_button]
|
||||
削除
|
||||
@@ -0,0 +1,608 @@
|
||||
[app_title]
|
||||
인 브 브즈
|
||||
---
|
||||
[tab_history]
|
||||
기록
|
||||
---
|
||||
[tab_manual]
|
||||
튜토리얼
|
||||
---
|
||||
[tab_settings]
|
||||
설정
|
||||
---
|
||||
[play_button]
|
||||
시작
|
||||
---
|
||||
[breath_button]
|
||||
숨쉼
|
||||
---
|
||||
[results_title]
|
||||
결과
|
||||
---
|
||||
[home_button]
|
||||
홈
|
||||
---
|
||||
[exit_session_title]
|
||||
세션을 종료하시겠습니까?
|
||||
---
|
||||
[save_completed_rounds_message]
|
||||
완료된 라운드를 저장한 후 종료하시겠습니까?
|
||||
---
|
||||
[cancel_button]
|
||||
취소
|
||||
---
|
||||
[save_button]
|
||||
저장
|
||||
---
|
||||
[save_results_button]
|
||||
저장
|
||||
---
|
||||
[discard_button]
|
||||
버리기
|
||||
---
|
||||
[all_progress_lost_message]
|
||||
모든 진행 상황이 손실됩니다.
|
||||
---
|
||||
[exit_button]
|
||||
종료
|
||||
---
|
||||
[round_times_title]
|
||||
라운드 시간
|
||||
---
|
||||
[results_rounds]
|
||||
%d 라운드
|
||||
---
|
||||
[results_best]
|
||||
최고 %ds
|
||||
---
|
||||
[results_avg]
|
||||
평균 %ds
|
||||
---
|
||||
[round_result_label]
|
||||
%d 라운드 %ds
|
||||
---
|
||||
[starting_in]
|
||||
%d초 후 시작
|
||||
---
|
||||
[settings_title]
|
||||
설정
|
||||
---
|
||||
[settings_tab_breathing]
|
||||
호흡
|
||||
---
|
||||
[settings_tab_session]
|
||||
세션
|
||||
---
|
||||
[settings_tab_sound]
|
||||
사운드
|
||||
---
|
||||
[settings_tab_appearance]
|
||||
외관
|
||||
---
|
||||
[settings_tab_language]
|
||||
언어
|
||||
---
|
||||
[settings_tab_data]
|
||||
데이터
|
||||
---
|
||||
[settings_tab_about]
|
||||
정보
|
||||
---
|
||||
[theme_label]
|
||||
테마
|
||||
---
|
||||
[speed_label]
|
||||
속도
|
||||
---
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
백그라운드 재생
|
||||
---
|
||||
[max_rounds_label]
|
||||
최대 라운드
|
||||
---
|
||||
[max_breaths_label]
|
||||
최대 호흡
|
||||
---
|
||||
[pause_after_round_label]
|
||||
라운드 후 일시정지
|
||||
---
|
||||
[advanced_session_controls_label]
|
||||
고급 세션 제어
|
||||
---
|
||||
[hold_display_label]
|
||||
홀드 표시
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
스톱워치
|
||||
---
|
||||
[hold_display_circle]
|
||||
원
|
||||
---
|
||||
[volume_label]
|
||||
음량
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
기본값으로 재설정
|
||||
---
|
||||
[fullscreen_label]
|
||||
전체화면
|
||||
---
|
||||
[language_label]
|
||||
언어
|
||||
---
|
||||
[language_picker_title]
|
||||
언어 선택
|
||||
---
|
||||
[next_button]
|
||||
다음
|
||||
---
|
||||
[coming_soon_label]
|
||||
출시 예정
|
||||
---
|
||||
[data_management_label]
|
||||
데이터 관리
|
||||
---
|
||||
[total_sessions_label]
|
||||
총 세션 수: %d
|
||||
---
|
||||
[data_size_label]
|
||||
데이터 크기: %s
|
||||
---
|
||||
[storage_label]
|
||||
저장소: %s
|
||||
---
|
||||
[export_data_button]
|
||||
데이터 내보내기
|
||||
---
|
||||
[delete_all_data_button]
|
||||
모든 데이터 삭제
|
||||
---
|
||||
[export_data_dialog_title]
|
||||
데이터 내보내기
|
||||
---
|
||||
[export_failed]
|
||||
내보내기 실패
|
||||
---
|
||||
[exported_label]
|
||||
내보내기 완료
|
||||
---
|
||||
[import_data_button]
|
||||
데이터 가져오기
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
데이터 가져오기
|
||||
---
|
||||
[import_failed]
|
||||
가져오기 실패
|
||||
---
|
||||
[imported_sessions]
|
||||
%d개 세션을 가져왔습니다
|
||||
---
|
||||
[import_invalid_file]
|
||||
잘못된 내보내기 파일
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
버전 %s
|
||||
---
|
||||
[about_description]
|
||||
인 브 브즈는 마음을 진정시키고
|
||||
편안해질 수 있도록 돕돕이 호흡 명상 앱입니다.
|
||||
|
||||
사용에 주의하세요.
|
||||
---
|
||||
[toggle_off]
|
||||
꺼짐
|
||||
---
|
||||
[toggle_on]
|
||||
켜짐
|
||||
---
|
||||
[theme_light]
|
||||
라이트
|
||||
---
|
||||
[theme_dark]
|
||||
다크
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
온스크린 키보드
|
||||
---
|
||||
[history_title]
|
||||
기록
|
||||
---
|
||||
[history_empty]
|
||||
아직 저장된 세션이 없습니다.
|
||||
세션을 완료하면 여기에 표시됩니다.
|
||||
---
|
||||
[history_month_label]
|
||||
%02d월
|
||||
---
|
||||
[history_day_label]
|
||||
%02d일
|
||||
---
|
||||
[history_round_short_label]
|
||||
R%d
|
||||
---
|
||||
[history_round_label]
|
||||
R%d %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d 평균 %ds
|
||||
---
|
||||
---
|
||||
[tutorial_title]
|
||||
튜토리얼
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
방법
|
||||
---
|
||||
[tutorial_step1_title]
|
||||
1단계: 들이마시 내뱨기
|
||||
---
|
||||
[tutorial_step2_title]
|
||||
2단계: 내뱨시 참기
|
||||
---
|
||||
[tutorial_step3_title]
|
||||
3단계: 들이마시 참기
|
||||
---
|
||||
[tutorial_progressive_speed_title]
|
||||
점진적 속도
|
||||
---
|
||||
[tutorial_step_intro]
|
||||
이 호흡 방법은 윔 호프 메서드를 기반으로 합니다.
|
||||
|
||||
강력하게 느낄 수 있습니다.
|
||||
주의해서 사용하세요.
|
||||
|
||||
앉거나 누워서 사용하세요.
|
||||
운전 중이나 서 있는 곳에서는 사용하지 마세요.
|
||||
---
|
||||
[tutorial_step_method]
|
||||
4단계를 따르세요:
|
||||
|
||||
1. 리듬하게 호흡합니다.
|
||||
2. 내뱨시고 참습니다.
|
||||
3. 깊게 들이마시고 참습니다.
|
||||
4. 내뱨시고 반복합니다.
|
||||
|
||||
톱니바 아이콘 %i를 사용하여 라운드, 호흡, 속도 및 일시정지를 조정할 수 있습니다.
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
폐를 완전히 채우고 자연스럽게 내뱨습니다.
|
||||
|
||||
이 컨트롤로 호흡 리듬의 템포를 설정합니다.
|
||||
|
||||
자연스러운 리듬을 찾으세요.
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
점진적 속도는 첫 라운드를 쉽게 시작할 수 있게 합니다.
|
||||
|
||||
활성화되면 첫 라운드는 속도 1에서 처음 5번 호흡을 하고 점차 선택한 속도까지 증가합니다.
|
||||
---
|
||||
[tutorial_step_exhale]
|
||||
호흡 라운드 후,
|
||||
자연스럽게 내뱨고 참습니다.
|
||||
|
||||
몸이 요청할 때까지 참으세요.
|
||||
억지로 하지 마세요.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
완전히 들이마시고 약 15초 동안 참습니다.
|
||||
|
||||
그런 다음 내뱨시고 다음 라운드를 시작합니다.
|
||||
시간이 지남에 따라 각 라운드가 더 깊어질 수 있습니다.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
건너뛰
|
||||
---
|
||||
[tutorial_back_button]
|
||||
뒤로
|
||||
---
|
||||
[tutorial_next_button]
|
||||
다음
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
완료
|
||||
---
|
||||
[share_sheet_title]
|
||||
세션 데이터 내보내기
|
||||
---
|
||||
[export_metadata_header]
|
||||
인 브 브즈 데이터 내보내기
|
||||
---
|
||||
[export_metadata_version]
|
||||
버전: %s
|
||||
---
|
||||
[export_metadata_date]
|
||||
내보내기 날짜: %s
|
||||
---
|
||||
[export_metadata_count]
|
||||
세션 수: %d
|
||||
---
|
||||
[delete_history_title]
|
||||
삭제하시겠습니까?
|
||||
---
|
||||
[delete_session_message]
|
||||
이 세션을 삭제하시겠습니까? 되돌릴 수 없습니다.
|
||||
---
|
||||
[delete_round_message]
|
||||
이 라운드를 삭제하시겠습니까? 되돌릴 수 없습니다.
|
||||
---
|
||||
[delete_button]
|
||||
삭제
|
||||
---
|
||||
[settings_category_practice]
|
||||
호흡 설정
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
호흡과 세션 조정
|
||||
---
|
||||
[settings_category_app]
|
||||
앱프 설정
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
외관과 사운드 커스터마이징
|
||||
---
|
||||
[settings_category_about_data]
|
||||
정보 및 데이터
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
정보 표시 및 데이터 관리
|
||||
---
|
||||
[progressive_speed_label]
|
||||
점진적 속도
|
||||
---
|
||||
[toggle_off]
|
||||
꺼짐
|
||||
---
|
||||
[toggle_on]
|
||||
켜짐
|
||||
---
|
||||
[round_times_title]
|
||||
라운드 시간
|
||||
---
|
||||
[R%d]
|
||||
%d 라운드
|
||||
---
|
||||
[C%d]
|
||||
%d초
|
||||
---
|
||||
[round_result_label]
|
||||
%d 라운드 %ds
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[session_rounds_label]
|
||||
%d/%d
|
||||
---
|
||||
[play_in_background_label]
|
||||
백그라운드 재생
|
||||
---
|
||||
[rounds_label]
|
||||
라운드
|
||||
---
|
||||
[breaths_label]
|
||||
호흡
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[C%d %ds]
|
||||
---
|
||||
[C%d %ds]
|
||||
---
|
||||
[exit_session_title_title]
|
||||
세션을 종료하시겠습니까?
|
||||
---
|
||||
[exit_session_title_message]
|
||||
진행 중인 세션입니다.
|
||||
진행 상태를 잃게 저장하고 종료하시겠습니까?
|
||||
---
|
||||
[exit_session_subtitle]
|
||||
진행 상태
|
||||
---
|
||||
[continue_button]
|
||||
계속
|
||||
---
|
||||
[confirm_button]
|
||||
확인
|
||||
---
|
||||
[round_times_title]
|
||||
라운드 시간
|
||||
---
|
||||
[R%d]
|
||||
%d 라운드
|
||||
---
|
||||
[C%d]
|
||||
%d초
|
||||
---
|
||||
[round_result_label]
|
||||
%d 라운드 %ds
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[session_rounds_label]
|
||||
%d/%d
|
||||
---
|
||||
[play_in_background_label]
|
||||
백그라운드 재생
|
||||
---
|
||||
[rounds_label]
|
||||
라운드
|
||||
---
|
||||
[breaths_label]
|
||||
호흡
|
||||
---
|
||||
[round_button_label]
|
||||
%d 라운드
|
||||
---
|
||||
[round_button_short_label]
|
||||
R%d
|
||||
---
|
||||
[round_settings_label]
|
||||
%d/%d
|
||||
---
|
||||
[round_short_label]
|
||||
%d/%d
|
||||
---
|
||||
[breaths_button_label]
|
||||
%d/%d
|
||||
---
|
||||
[breaths_short_label]
|
||||
%d/%d
|
||||
---
|
||||
[C%d]
|
||||
%d초
|
||||
---
|
||||
[C%d]
|
||||
%d초
|
||||
---
|
||||
[C%d]
|
||||
%d초
|
||||
---
|
||||
[history_edit_title]
|
||||
편집
|
||||
---
|
||||
[history_edit_done]
|
||||
완료
|
||||
---
|
||||
[history_edit_cancel]
|
||||
취소
|
||||
---
|
||||
[history_delete_title]
|
||||
기록 삭제
|
||||
---
|
||||
[history_delete_message]
|
||||
이 기록을 삭제하시겠습니까?
|
||||
---
|
||||
[pause_button_label]
|
||||
일시정지
|
||||
---
|
||||
[resume_button_label]
|
||||
재개
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
폐를 완전히 채우고 자연스럽게 내뱨세요.
|
||||
|
||||
이 컨트롤로 호흡 리듬의 템포를 설정합니다.
|
||||
|
||||
자연스러운 리듬을 찾으세요.
|
||||
---
|
||||
[tutorial_step_exhale]
|
||||
호흡 라운드 후,
|
||||
자연스럽게 내뱨시고 참습니다.
|
||||
|
||||
시체가 공기가 필요할 때까지 참으세요.
|
||||
강제로 하지 마세요.
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
완전히 들이마시고 약 15초 동안 참습니다.
|
||||
|
||||
그 다음 내뱨시고 다음 라운드를 시작합니다.
|
||||
시간이 지남에 따라 각 라운드가 더 깊어질 수 있습니다.
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
건너뛰
|
||||
---
|
||||
[tutorial_back_button]
|
||||
뒤로
|
||||
---
|
||||
[tutorial_next_button]
|
||||
다음
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
완료
|
||||
---
|
||||
[share_sheet_title]
|
||||
세션 데이터 내보내기
|
||||
---
|
||||
[export_metadata_header]
|
||||
인 브 브즈 데이터 내보내기
|
||||
---
|
||||
[export_metadata_version]
|
||||
버전: %s
|
||||
---
|
||||
[export_metadata_date]
|
||||
내보내기 날짜: %s
|
||||
---
|
||||
[export_metadata_count]
|
||||
세션 수: %d
|
||||
---
|
||||
[delete_history_title]
|
||||
기록 삭제
|
||||
---
|
||||
[delete_session_message]
|
||||
이 기록을 삭제하시겠습니까? 되돌릴 수 없습니다.
|
||||
---
|
||||
[delete_round_message]
|
||||
이 라운드를 삭제하시겠습니까? 되돌릴 수 없습니다.
|
||||
---
|
||||
[delete_button]
|
||||
삭제
|
||||
---
|
||||
[settings_category_practice]
|
||||
호흡 설정
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
호흡과 세션 조정
|
||||
---
|
||||
[settings_category_app]
|
||||
앱프 설정
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
외관과 사운드 커스터마이징
|
||||
---
|
||||
[settings_category_about_data]
|
||||
정보 및 데이터
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
정보 표시 및 데이터 관리
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
[round_result_label]
|
||||
%d 라운드 %ds
|
||||
---
|
||||
[R%d %ds]
|
||||
---
|
||||
---
|
||||
[history_round_short_label]
|
||||
R%d
|
||||
---
|
||||
[history_round_label]
|
||||
R%d %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d 평균 %ds
|
||||
---
|
||||
@@ -94,8 +94,8 @@ Tema
|
||||
[speed_label]
|
||||
Velocidade
|
||||
---
|
||||
[progressive_speed_label]
|
||||
Velocidade progressiva
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
Executar em segundo plano
|
||||
@@ -112,6 +112,15 @@ Pausa após rodada
|
||||
[advanced_session_controls_label]
|
||||
Controles avançados da sessão
|
||||
---
|
||||
[hold_display_label]
|
||||
Exibicao da retencao
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
Cronometro
|
||||
---
|
||||
[hold_display_circle]
|
||||
Circulo
|
||||
---
|
||||
[volume_label]
|
||||
Volume
|
||||
---
|
||||
@@ -158,7 +167,46 @@ Exportar dados
|
||||
Falha ao exportar
|
||||
---
|
||||
[exported_label]
|
||||
Exportado: %s
|
||||
Exportado
|
||||
---
|
||||
[import_data_button]
|
||||
Importar dados
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
Importar dados
|
||||
---
|
||||
[import_failed]
|
||||
Falha ao importar
|
||||
---
|
||||
[imported_sessions]
|
||||
%d sessões importadas
|
||||
---
|
||||
[import_invalid_file]
|
||||
Arquivo de exportação inválido
|
||||
---
|
||||
[import_cancelled]
|
||||
Importação cancelada
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
Versão %s
|
||||
@@ -174,6 +222,12 @@ OFF
|
||||
[toggle_on]
|
||||
ON
|
||||
---
|
||||
[theme_light]
|
||||
Claro
|
||||
---
|
||||
[theme_dark]
|
||||
Escuro
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
Teclado na tela
|
||||
---
|
||||
@@ -202,6 +256,9 @@ R%d %ds
|
||||
[tutorial_title]
|
||||
Tutorial
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
Método
|
||||
---
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
[app_title]
|
||||
内息清风
|
||||
---
|
||||
[tab_history]
|
||||
历史
|
||||
---
|
||||
[tab_manual]
|
||||
教程
|
||||
---
|
||||
[tab_settings]
|
||||
设置
|
||||
---
|
||||
[play_button]
|
||||
开始
|
||||
---
|
||||
[breath_button]
|
||||
呼吸
|
||||
---
|
||||
[results_title]
|
||||
结果
|
||||
---
|
||||
[home_button]
|
||||
主页
|
||||
---
|
||||
[exit_session_title]
|
||||
退出本次练习?
|
||||
---
|
||||
[save_completed_rounds_message]
|
||||
退出前保存已完成的轮次?
|
||||
---
|
||||
[cancel_button]
|
||||
取消
|
||||
---
|
||||
[save_button]
|
||||
保存
|
||||
---
|
||||
[save_results_button]
|
||||
保存
|
||||
---
|
||||
[discard_button]
|
||||
丢弃
|
||||
---
|
||||
[all_progress_lost_message]
|
||||
所有进度都会丢失。
|
||||
---
|
||||
[exit_button]
|
||||
退出
|
||||
---
|
||||
[round_times_title]
|
||||
轮次时间
|
||||
---
|
||||
[results_rounds]
|
||||
%d 轮
|
||||
---
|
||||
[results_best]
|
||||
最佳 %ds
|
||||
---
|
||||
[results_avg]
|
||||
平均 %ds
|
||||
---
|
||||
[round_result_label]
|
||||
第%d轮 %ds
|
||||
---
|
||||
[starting_in]
|
||||
即将开始 %2d
|
||||
---
|
||||
[settings_title]
|
||||
设置
|
||||
---
|
||||
[settings_tab_breathing]
|
||||
呼吸
|
||||
---
|
||||
[settings_tab_session]
|
||||
练习
|
||||
---
|
||||
[settings_tab_sound]
|
||||
音效
|
||||
---
|
||||
[settings_tab_appearance]
|
||||
外观
|
||||
---
|
||||
[settings_tab_language]
|
||||
语言
|
||||
---
|
||||
[settings_tab_data]
|
||||
数据
|
||||
---
|
||||
[settings_tab_about]
|
||||
关于
|
||||
---
|
||||
[settings_category_practice]
|
||||
练习设置
|
||||
---
|
||||
[settings_category_practice_desc]
|
||||
配置呼吸和练习
|
||||
---
|
||||
[settings_category_app]
|
||||
应用偏好
|
||||
---
|
||||
[settings_category_app_desc]
|
||||
自定义外观和音频
|
||||
---
|
||||
[settings_category_about_data]
|
||||
关于与数据
|
||||
---
|
||||
[settings_category_about_data_desc]
|
||||
查看信息并管理数据
|
||||
---
|
||||
[theme_label]
|
||||
主题
|
||||
---
|
||||
[speed_label]
|
||||
速度
|
||||
---
|
||||
|
||||
Start speed
|
||||
---
|
||||
[play_in_background_label]
|
||||
后台播放
|
||||
---
|
||||
[max_rounds_label]
|
||||
最大轮次
|
||||
---
|
||||
[max_breaths_label]
|
||||
最大呼吸次数
|
||||
---
|
||||
[pause_after_round_label]
|
||||
每轮后暂停
|
||||
---
|
||||
[advanced_session_controls_label]
|
||||
高级练习控制
|
||||
---
|
||||
[hold_display_label]
|
||||
屏息显示
|
||||
---
|
||||
[hold_display_stopwatch]
|
||||
秒表
|
||||
---
|
||||
[hold_display_circle]
|
||||
圆圈
|
||||
---
|
||||
[volume_label]
|
||||
音量
|
||||
---
|
||||
[reset_to_defaults_label]
|
||||
恢复默认
|
||||
---
|
||||
[fullscreen_label]
|
||||
全屏
|
||||
---
|
||||
[language_label]
|
||||
语言
|
||||
---
|
||||
[language_picker_title]
|
||||
选择语言
|
||||
---
|
||||
[next_button]
|
||||
下一步
|
||||
---
|
||||
[coming_soon_label]
|
||||
即将推出...
|
||||
---
|
||||
[data_management_label]
|
||||
数据管理
|
||||
---
|
||||
[total_sessions_label]
|
||||
总练习次数:%d
|
||||
---
|
||||
[data_size_label]
|
||||
数据大小:%s
|
||||
---
|
||||
[storage_label]
|
||||
存储:%s
|
||||
---
|
||||
[export_data_button]
|
||||
导出数据
|
||||
---
|
||||
[delete_all_data_button]
|
||||
删除全部数据
|
||||
---
|
||||
[export_data_dialog_title]
|
||||
导出数据
|
||||
---
|
||||
[export_failed]
|
||||
导出失败
|
||||
---
|
||||
[exported_label]
|
||||
已导出
|
||||
---
|
||||
[import_data_button]
|
||||
导入数据
|
||||
---
|
||||
[import_data_dialog_title]
|
||||
导入数据
|
||||
---
|
||||
[import_failed]
|
||||
导入失败
|
||||
---
|
||||
[imported_sessions]
|
||||
已导入 %d 个会话
|
||||
---
|
||||
[import_invalid_file]
|
||||
无效的导出文件
|
||||
---
|
||||
[import_cancelled]
|
||||
Import cancelled
|
||||
---
|
||||
[export_cancelled]
|
||||
Export cancelled
|
||||
---
|
||||
[no_data_to_export]
|
||||
No data to export
|
||||
---
|
||||
[no_data_to_delete]
|
||||
No data to delete
|
||||
---
|
||||
[delete_all_data_title]
|
||||
Delete all data?
|
||||
---
|
||||
[delete_all_data_message]
|
||||
This will permanently delete all saved sessions.
|
||||
---
|
||||
[delete_cancelled]
|
||||
Delete cancelled
|
||||
---
|
||||
[deleted_sessions]
|
||||
Deleted %lld sessions
|
||||
---
|
||||
[version_label]
|
||||
版本 %s
|
||||
---
|
||||
[about_description]
|
||||
Inner Breeze 是一款简单的呼吸冥想应用,帮助你放松并平静下来。
|
||||
---
|
||||
[toggle_off]
|
||||
关
|
||||
---
|
||||
[toggle_on]
|
||||
开
|
||||
---
|
||||
[theme_light]
|
||||
浅色
|
||||
---
|
||||
[theme_dark]
|
||||
深色
|
||||
---
|
||||
[on_screen_keyboard_label]
|
||||
屏幕键盘
|
||||
---
|
||||
[history_title]
|
||||
历史
|
||||
---
|
||||
[history_empty]
|
||||
还没有保存的练习。
|
||||
完成一次练习后会添加到这里。
|
||||
---
|
||||
[history_month_label]
|
||||
%02d 月
|
||||
---
|
||||
[history_day_label]
|
||||
第 %02d 天
|
||||
---
|
||||
[history_round_short_label]
|
||||
第%d轮
|
||||
---
|
||||
[history_round_label]
|
||||
第%d轮 %ds
|
||||
---
|
||||
[history_session_label]
|
||||
%02d:%02d 平均 %ds
|
||||
---
|
||||
[tutorial_title]
|
||||
教程
|
||||
---
|
||||
[tutorial_page_label]
|
||||
%d/%d
|
||||
---
|
||||
[tutorial_method_title]
|
||||
方法
|
||||
---
|
||||
[tutorial_step1_title]
|
||||
第 1 步:吸气与呼气
|
||||
---
|
||||
[tutorial_step2_title]
|
||||
第 2 步:呼气与屏息
|
||||
---
|
||||
[tutorial_step3_title]
|
||||
第 3 步:吸气与屏息
|
||||
---
|
||||
[tutorial_progressive_speed_title]
|
||||
递进速度
|
||||
---
|
||||
[tutorial_step_intro]
|
||||
这项呼吸练习基于 Wim Hof Method。
|
||||
|
||||
它可能很强烈,请谨慎使用。
|
||||
|
||||
请坐着或躺下练习。
|
||||
切勿在驾驶、
|
||||
站立或水中时进行。
|
||||
---
|
||||
[tutorial_step_method]
|
||||
按照 4 个步骤进行:
|
||||
|
||||
1. 有节奏地呼吸。
|
||||
2. 呼气并屏息。
|
||||
3. 深吸气并屏息。
|
||||
4. 呼气并重复。
|
||||
|
||||
使用齿轮图标 %i 调整轮次、呼吸次数、速度和暂停时间。
|
||||
---
|
||||
[tutorial_step_breathe]
|
||||
充分充满肺部,然后让呼吸自然流出。
|
||||
|
||||
使用这个滑块设置呼吸圆的节奏。
|
||||
---
|
||||
[tutorial_step_progressive_speed]
|
||||
递进速度会让第一轮更容易进入。
|
||||
---
|
||||
[tutorial_step_exhale_hold]
|
||||
完成一轮呼吸后,
|
||||
呼气并屏住。
|
||||
|
||||
屏息到需要吸气为止。
|
||||
---
|
||||
[tutorial_step_inhale_hold]
|
||||
充分吸气并屏住约 15 秒。
|
||||
---
|
||||
[tutorial_skip_button]
|
||||
跳过
|
||||
---
|
||||
[tutorial_back_button]
|
||||
返回
|
||||
---
|
||||
[tutorial_next_button]
|
||||
下一步
|
||||
---
|
||||
[tutorial_finish_button]
|
||||
完成
|
||||
---
|
||||
[share_sheet_title]
|
||||
导出练习数据
|
||||
---
|
||||
[export_metadata_header]
|
||||
Inner Breeze 数据导出
|
||||
---
|
||||
[export_metadata_version]
|
||||
版本:%s
|
||||
---
|
||||
[export_metadata_date]
|
||||
导出日期:%s
|
||||
---
|
||||
[export_metadata_count]
|
||||
练习次数:%d
|
||||
---
|
||||
[delete_history_title]
|
||||
删除?
|
||||
---
|
||||
[delete_session_message]
|
||||
删除这次练习?此操作无法撤销。
|
||||
---
|
||||
[delete_round_message]
|
||||
删除这一轮?此操作无法撤销。
|
||||
---
|
||||
[delete_button]
|
||||
删除
|
||||
@@ -0,0 +1,153 @@
|
||||
android-init-signing:
|
||||
@echo "Generating release keystore..."
|
||||
@mkdir -p ~/.android
|
||||
keytool -genkeypair -v -storetype PKCS12 \
|
||||
-keystore ~/.android/inbe-release.keystore \
|
||||
-alias inbe-key \
|
||||
-keyalg RSA \
|
||||
-keysize 4096 \
|
||||
-validity 10000
|
||||
@echo ""
|
||||
@echo "Keystore created at ~/.android/inbe-release.keystore"
|
||||
@echo ""
|
||||
@echo "Add this line to $(ANDROID_DIR)/local.properties:"
|
||||
@echo " keystore.path=$$HOME/.android/inbe-release.keystore"
|
||||
|
||||
android-copy-assets:
|
||||
$(MAKE) $(FONT_FILES)
|
||||
rm -rf $(ANDROID_DIR)/app/src/main/assets
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets
|
||||
cp $(CONFIG_FILES) $(ANDROID_DIR)/app/src/main/assets/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/locales
|
||||
cp $(LOCALE_FILES) $(ANDROID_DIR)/app/src/main/assets/locales/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/themes
|
||||
cp $(THEME_FILES) $(ANDROID_DIR)/app/src/main/assets/themes/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/assets
|
||||
cp $(IMAGE_FILES) $(ANDROID_DIR)/app/src/main/assets/assets/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/assets/fonts
|
||||
cp $(FONT_FILES) $(ANDROID_DIR)/app/src/main/assets/assets/fonts/
|
||||
mkdir -p $(ANDROID_DIR)/app/src/main/assets/assets/sounds
|
||||
cp $(SOUND_FILES) $(ANDROID_DIR)/app/src/main/assets/assets/sounds/
|
||||
|
||||
android-debug:
|
||||
$(MAKE) android-copy-assets
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleDebug
|
||||
$(MAKE) android-copy-debug-apks
|
||||
|
||||
android-release:
|
||||
$(MAKE) android-copy-assets
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-release-apks; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) assembleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-release-apks; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-bundle:
|
||||
$(MAKE) android-copy-assets
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) bundleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-bundle; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
if [ -n "$$PASSWORD_VALUE" ]; then \
|
||||
unset ANDROID_HOME; $(GRADLE) -p $(ANDROID_DIR) bundleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
|
||||
$(MAKE) android-copy-bundle; \
|
||||
else \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-bundle: | $(ANDROID_BUILD_DIR)
|
||||
@VERSION=$$(grep -m1 '^## \[' CHANGELOG.md | sed 's/^## \[\([^]]*\)\].*/\1/'); \
|
||||
BUNDLE=$$(find $(ANDROID_DIR)/app/build/outputs/bundle/release -name "*.aab" 2>/dev/null | head -1); \
|
||||
if [ -n "$$BUNDLE" ] && [ -f "$$BUNDLE" ]; then \
|
||||
VERSIONED_BUNDLE="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.aab"; \
|
||||
echo "Copying and renaming $$BUNDLE to $$VERSIONED_BUNDLE"; \
|
||||
cp "$$BUNDLE" "$$VERSIONED_BUNDLE"; \
|
||||
ln -sf "$$(basename "$$VERSIONED_BUNDLE")" "$(ANDROID_BUILD_DIR)/inbe-latest.aab"; \
|
||||
echo "Created symlink: inbe-latest.aab -> $$(basename "$$VERSIONED_BUNDLE")"; \
|
||||
else \
|
||||
echo "Bundle not found in $(ANDROID_DIR)/app/build/outputs/bundle/release/"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
android-copy-apks: android-copy-debug-apks android-copy-release-apks
|
||||
|
||||
android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
|
||||
@for apk in $(ANDROID_DIR)/app/build/outputs/apk/debug/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
echo "Copying $$apk"; \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
@VERSION=$$(grep INBE_VERSION_STRING src/version.h | grep -o '"[^"]*"' | tr -d '"'); \
|
||||
UNIVERSAL_APK=$$(find $(ANDROID_DIR)/app/build/outputs/apk/release -name "app-universal-release.apk" 2>/dev/null); \
|
||||
if [ -n "$$UNIVERSAL_APK" ] && [ -f "$$UNIVERSAL_APK" ]; then \
|
||||
VERSIONED_APK="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.apk"; \
|
||||
echo "Copying and renaming $$UNIVERSAL_APK to $$VERSIONED_APK"; \
|
||||
cp "$$UNIVERSAL_APK" "$$VERSIONED_APK"; \
|
||||
ln -sf "$$(basename "$$VERSIONED_APK")" "$(ANDROID_BUILD_DIR)/inbe-latest.apk"; \
|
||||
echo "Created symlink: inbe-latest.apk -> $$(basename "$$VERSIONED_APK")"; \
|
||||
else \
|
||||
for apk in $(ANDROID_DIR)/app/build/outputs/apk/release/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
echo "Copying $$apk"; \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
android-install: android-debug
|
||||
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
|
||||
echo "Device ABI: $$ABI"; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/debug/app-$${ABI}-debug.apk; \
|
||||
if [ ! -f "$$APK" ]; then \
|
||||
echo "APK not found for $$ABI, trying universal..."; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk; \
|
||||
fi; \
|
||||
echo "Installing: $$APK"; \
|
||||
adb install -r "$$APK"
|
||||
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
|
||||
|
||||
android-install-release: android-release
|
||||
@ABI=$$(adb shell getprop ro.product.cpu.abi | tr -d '\r'); \
|
||||
echo "Device ABI: $$ABI"; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/release/app-$${ABI}-release.apk; \
|
||||
if [ ! -f "$$APK" ]; then \
|
||||
echo "APK not found for $$ABI, trying universal..."; \
|
||||
APK=$(ANDROID_DIR)/app/build/outputs/apk/release/app-release.apk; \
|
||||
fi; \
|
||||
echo "Installing: $$APK"; \
|
||||
adb install -r "$$APK"
|
||||
adb shell am start -n $(ANDROID_APP_ID)/$(ANDROID_ACTIVITY)
|
||||
|
||||
android-clean:
|
||||
$(GRADLE) -p $(ANDROID_DIR) clean
|
||||
rm -rf $(ANDROID_BUILD_DIR)
|
||||
@@ -0,0 +1,18 @@
|
||||
clean:
|
||||
rm -rf build
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-linux:
|
||||
rm -rf $(LINUX_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-windows:
|
||||
rm -rf $(WINDOWS_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
|
||||
clean-web:
|
||||
rm -rf $(WEB_BUILD_DIR)
|
||||
|
||||
clean-raylib:
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
rm -rf vendor/raylib/build
|
||||
@@ -0,0 +1,114 @@
|
||||
CC = gcc
|
||||
WINDRES = windres
|
||||
|
||||
SRC = src/main.c src/app.c src/app_session.c src/locale.c src/theme_meta.c src/theme.c src/data.c src/miniz.c src/android/android_share.c src/tabs/history_tab.c src/tabs/language_tab.c src/tabs/manual_tab.c src/tabs/settings_tab.c
|
||||
INBE_DIR = libinbe
|
||||
INBE_A = $(INBE_DIR)/libinbe.a
|
||||
|
||||
RAYLIB_DIR = vendor/raylib/src
|
||||
RAYLIB_BUILD_DIR = vendor/raylib/build/sdl
|
||||
RAYLIB_A = $(RAYLIB_BUILD_DIR)/libraylib.a
|
||||
RAYLIB_SOURCES = $(wildcard $(RAYLIB_DIR)/*.c) $(wildcard $(RAYLIB_DIR)/*.h)
|
||||
|
||||
FLINT_DIR = vendor/flint
|
||||
FLINT_SRCS = $(wildcard $(FLINT_DIR)/src/*.c)
|
||||
FLINT_INCLUDE = -I$(FLINT_DIR)/include
|
||||
|
||||
ANDROID_DIR = droid
|
||||
GRADLE = gradle
|
||||
ANDROID_APP_ID = xyz.waozi.inbe
|
||||
ANDROID_ACTIVITY = android.app.NativeActivity
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
PLATFORM = linux
|
||||
else ifeq ($(UNAME_S),Darwin)
|
||||
PLATFORM = macos
|
||||
else
|
||||
PLATFORM = unknown
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_M),x86_64)
|
||||
ARCH = x86_64
|
||||
else ifeq ($(UNAME_M),aarch64)
|
||||
ARCH = aarch64
|
||||
else ifeq ($(UNAME_M),armv7l)
|
||||
ARCH = arm
|
||||
else
|
||||
ARCH = $(UNAME_M)
|
||||
endif
|
||||
|
||||
BUILD_DIR = build
|
||||
LINUX_BUILD_DIR = $(BUILD_DIR)/linux
|
||||
WINDOWS_BUILD_DIR = $(BUILD_DIR)/windows
|
||||
ANDROID_BUILD_DIR = $(BUILD_DIR)/android
|
||||
WEB_BUILD_DIR = $(BUILD_DIR)/web
|
||||
LINUX_ARCHES = x86_64 aarch64
|
||||
ANDROID_DIST ?= release
|
||||
|
||||
INSTALL_DIR = $(HOME)/.local/share/inbe
|
||||
BIN_DIR = $(HOME)/bin
|
||||
TARBALL = $(LINUX_BUILD_DIR)/inbe-linux.tar.gz
|
||||
|
||||
CONFIG_FILES = inbe.ini theme.ini
|
||||
LOCALE_FILES = $(wildcard locales/*.txt)
|
||||
THEME_FILES = $(wildcard $(FLINT_DIR)/themes/*.ini)
|
||||
IMAGE_FILES = assets/angel.jpg assets/begin.jpg
|
||||
SOUND_FILES = assets/sounds/breath-in.ogg assets/sounds/breath-out.ogg assets/sounds/bell.ogg
|
||||
FONT_OUTPUTS = assets/fonts/locales.png assets/fonts/locales.dat
|
||||
FONT_FILES = $(FONT_OUTPUTS)
|
||||
FONT_TOOL = vendor/otfchop/otfchop
|
||||
FONT_SOURCE = vendor/otfchop/unifont-17.0.04.otf
|
||||
BUILD_MAKEFILES = Makefile mk/common.mk mk/native.mk mk/windows.mk mk/web.mk mk/android.mk mk/dist.mk mk/clean.mk
|
||||
|
||||
assets/fonts:
|
||||
mkdir -p $@
|
||||
|
||||
$(FONT_OUTPUTS): $(LOCALE_FILES) $(FONT_TOOL) | assets/fonts
|
||||
$(FONT_TOOL) $(FONT_SOURCE) $(LOCALE_FILES) assets/fonts/locales
|
||||
|
||||
$(FONT_TOOL): vendor/otfchop/otfchop.c vendor/otfchop/stb_truetype.h vendor/otfchop/stb_image_write.h
|
||||
$(MAKE) -C vendor/otfchop otfchop
|
||||
|
||||
INBE_RAYLIB_CONFIG = $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
|
||||
CFLAGS = -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DMINIZ_NO_ZLIB_COMPATIBLE_NAMES
|
||||
LDFLAGS = -Wl,--gc-sections -s
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
ifeq ($(strip $(RAY_CFLAGS)),)
|
||||
$(error RAY_CFLAGS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_LDLIBS)),)
|
||||
$(error RAY_LDLIBS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_LDLIBS)),)
|
||||
$(error RAY_SDL_LDLIBS is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_INCLUDE_DIR)),)
|
||||
$(error RAY_SDL_INCLUDE_DIR is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
ifeq ($(strip $(RAY_RAYLIB_CONFIG)),)
|
||||
$(error RAY_RAYLIB_CONFIG is not set. Enter the ray flake shell with 'nix develop')
|
||||
endif
|
||||
|
||||
build:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
$(LINUX_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WINDOWS_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(ANDROID_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WEB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(RAYLIB_BUILD_DIR): build
|
||||
mkdir -p $@
|
||||
@@ -0,0 +1,135 @@
|
||||
dist:
|
||||
@# Get password once for both Android builds
|
||||
@if [ -n "$(PASSWORD)" ]; then \
|
||||
PASSWORD_VALUE="$(PASSWORD)"; \
|
||||
elif [ -t 0 ]; then \
|
||||
printf "Keystore password: "; \
|
||||
stty -echo; \
|
||||
read PASSWORD_VALUE; \
|
||||
stty echo; \
|
||||
printf "\n"; \
|
||||
else \
|
||||
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -z "$$PASSWORD_VALUE" ]; then \
|
||||
echo "Keystore password is required"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "Building Android release APK (validating password)..."; \
|
||||
$(MAKE) android-release PASSWORD="$$PASSWORD_VALUE" || exit $$?; \
|
||||
echo "Building Android bundle..."; \
|
||||
$(MAKE) android-bundle PASSWORD="$$PASSWORD_VALUE" || exit $$?; \
|
||||
echo "✓ Android builds complete, proceeding with desktop builds..."; \
|
||||
$(MAKE) linux || exit $$?; \
|
||||
$(MAKE) windows || exit $$?; \
|
||||
$(MAKE) web || exit $$?; \
|
||||
$(MAKE) dist-linux || exit $$?; \
|
||||
$(MAKE) dist-windows || exit $$?
|
||||
|
||||
dist-linux: linux
|
||||
@echo "Creating Linux tar.gz package with all Linux arch binaries..."
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux
|
||||
@for bin in $(LINUX_BUILD_DIR)/inbe-linux-*; do \
|
||||
if [ -f "$$bin" ] && [ -x "$$bin" ]; then \
|
||||
echo "Adding $$bin"; \
|
||||
cp "$$bin" "$(LINUX_BUILD_DIR)/dist/inbe-linux/$$(basename "$$bin")"; \
|
||||
fi; \
|
||||
done
|
||||
@if [ -z "$$(find $(LINUX_BUILD_DIR)/dist/inbe-linux -type f 2>/dev/null)" ]; then \
|
||||
echo "No Linux binaries found in $(LINUX_BUILD_DIR)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp $(CONFIG_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/locales
|
||||
@cp $(LOCALE_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/locales/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/themes
|
||||
@cp $(THEME_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/themes/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets
|
||||
@cp $(IMAGE_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/fonts
|
||||
@cp $(FONT_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/fonts/
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/sounds
|
||||
@cp $(SOUND_FILES) $(LINUX_BUILD_DIR)/dist/inbe-linux/assets/sounds/
|
||||
@cd $(LINUX_BUILD_DIR)/dist && tar -czf ../inbe-linux.tar.gz inbe-linux/
|
||||
@rm -rf $(LINUX_BUILD_DIR)/dist
|
||||
@echo "Created $(LINUX_BUILD_DIR)/inbe-linux.tar.gz"
|
||||
|
||||
install: dist-linux
|
||||
@echo "Installing inbe to $(INSTALL_DIR)..."
|
||||
@mkdir -p $(INSTALL_DIR)
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@tar -xzf $(TARBALL) -C $(INSTALL_DIR)
|
||||
@ARCH=$$(uname -m); \
|
||||
if [ "$$ARCH" != "x86_64" ] && [ "$$ARCH" != "aarch64" ]; then \
|
||||
echo "Warning: Unsupported architecture $$ARCH, defaulting to x86_64"; \
|
||||
ARCH="x86_64"; \
|
||||
fi; \
|
||||
BINARY_PATH="$(INSTALL_DIR)/inbe-linux/inbe-linux-$$ARCH"; \
|
||||
if [ ! -f "$$BINARY_PATH" ]; then \
|
||||
echo "Error: Binary not found: $$BINARY_PATH"; \
|
||||
echo "Available binaries:"; \
|
||||
ls $(INSTALL_DIR)/inbe-linux/inbe-linux-* 2>/dev/null || echo " None"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -L $(BIN_DIR)/inbe ]; then \
|
||||
echo "Removing existing symlink: $(BIN_DIR)/inbe"; \
|
||||
rm $(BIN_DIR)/inbe; \
|
||||
elif [ -e $(BIN_DIR)/inbe ]; then \
|
||||
echo "Error: $(BIN_DIR)/inbe exists and is not a symlink"; \
|
||||
echo "Please remove it manually and try again"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
ln -s "$$BINARY_PATH" $(BIN_DIR)/inbe && \
|
||||
echo "Created symlink: $(BIN_DIR)/inbe -> $$BINARY_PATH" && \
|
||||
echo "" && \
|
||||
echo "Installation complete!" && \
|
||||
echo " Binary: $(BIN_DIR)/inbe" && \
|
||||
echo " Data: $(INSTALL_DIR)/inbe-linux/" && \
|
||||
echo "" && \
|
||||
echo "Run 'inbe' to start the application"
|
||||
|
||||
uninstall:
|
||||
@echo "Uninstalling inbe..."
|
||||
@if [ -L $(BIN_DIR)/inbe ]; then \
|
||||
echo "Removing symlink: $(BIN_DIR)/inbe"; \
|
||||
rm $(BIN_DIR)/inbe; \
|
||||
elif [ -e $(BIN_DIR)/inbe ]; then \
|
||||
echo "Warning: $(BIN_DIR)/inbe exists but is not a symlink"; \
|
||||
echo "Skipping symlink removal"; \
|
||||
fi
|
||||
@if [ -d $(INSTALL_DIR) ]; then \
|
||||
echo "Removing directory: $(INSTALL_DIR)"; \
|
||||
rm -rf $(INSTALL_DIR); \
|
||||
else \
|
||||
echo "Install directory not found: $(INSTALL_DIR)"; \
|
||||
fi
|
||||
@echo "Uninstall complete"
|
||||
|
||||
dist-windows:
|
||||
@echo "Creating Windows zip package with all Windows arch binaries..."
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows
|
||||
@for bin in $(WINDOWS_BUILD_DIR)/inbe-windows-*.exe; do \
|
||||
if [ -f "$$bin" ]; then \
|
||||
echo "Adding $$bin"; \
|
||||
cp "$$bin" "$(WINDOWS_BUILD_DIR)/dist/inbe-windows/$$(basename "$$bin")"; \
|
||||
fi; \
|
||||
done
|
||||
@if [ -z "$$(find $(WINDOWS_BUILD_DIR)/dist/inbe-windows -type f 2>/dev/null)" ]; then \
|
||||
echo "No Windows binaries found in $(WINDOWS_BUILD_DIR)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp $(CONFIG_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/locales
|
||||
@cp $(LOCALE_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/locales/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes
|
||||
@cp $(THEME_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/themes/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets
|
||||
@cp $(IMAGE_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/fonts
|
||||
@cp $(FONT_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/fonts/
|
||||
@mkdir -p $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/sounds
|
||||
@cp $(SOUND_FILES) $(WINDOWS_BUILD_DIR)/dist/inbe-windows/assets/sounds/
|
||||
@cd $(WINDOWS_BUILD_DIR)/dist && zip -r ../inbe-windows.zip inbe-windows/
|
||||
@rm -rf $(WINDOWS_BUILD_DIR)/dist
|
||||
@echo "Created $(WINDOWS_BUILD_DIR)/inbe-windows.zip"
|
||||
@@ -0,0 +1,107 @@
|
||||
BINARY_NAME = inbe-$(PLATFORM)-$(ARCH)
|
||||
TARGET = $(LINUX_BUILD_DIR)/$(BINARY_NAME)
|
||||
LINUX_INBE_A = $(LINUX_BUILD_DIR)/libinbe.a
|
||||
|
||||
all: native
|
||||
|
||||
native: $(TARGET)
|
||||
|
||||
$(RAYLIB_A): $(RAYLIB_SOURCES) | $(RAYLIB_BUILD_DIR)
|
||||
$(MAKE) -j1 -C $(RAYLIB_DIR) \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../build/sdl \
|
||||
RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=FALSE \
|
||||
SDL_INCLUDE_PATH="$(RAY_SDL_INCLUDE_DIR)" \
|
||||
SDL_LIBRARIES="$(RAY_SDL_LDLIBS)" \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(INBE_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
|
||||
$(LINUX_INBE_A): FORCE | $(LINUX_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
$(MAKE) -C $(INBE_DIR) CC=$(CC) AR=ar
|
||||
cp $(INBE_A) $@
|
||||
|
||||
$(TARGET): $(SRC) $(FLINT_SRCS) $(FONT_FILES) theme.ini inbe.ini $(RAYLIB_A) $(LINUX_INBE_A) | $(LINUX_BUILD_DIR)
|
||||
$(CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
$(FLINT_INCLUDE) \
|
||||
-Isrc -Isrc/android \
|
||||
$(RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(FLINT_SRCS) \
|
||||
$(LINUX_INBE_A) \
|
||||
$(RAYLIB_A) \
|
||||
$(RAY_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
linux: $(LINUX_ARCHES:%=linux-%)
|
||||
|
||||
linux-x86_64: | $(LINUX_BUILD_DIR)
|
||||
$(MAKE) build-linux-arch \
|
||||
ARCH_NAME=x86_64 \
|
||||
LINUX_CC="$(CC)" \
|
||||
LINUX_AR=ar \
|
||||
LINUX_RAY_CFLAGS="$(RAY_CFLAGS)" \
|
||||
LINUX_RAY_LDLIBS="$(RAY_LDLIBS)" \
|
||||
LINUX_RAY_SDL_LDLIBS="$(RAY_SDL_LDLIBS)" \
|
||||
LINUX_RAY_SDL_INCLUDE_DIR="$(RAY_SDL_INCLUDE_DIR)"
|
||||
|
||||
linux-aarch64: | $(LINUX_BUILD_DIR)
|
||||
@if [ -z "$(AARCH64_CC)" ] || [ -z "$(AARCH64_AR)" ] || [ -z "$(AARCH64_RAY_CFLAGS)" ] || [ -z "$(AARCH64_RAY_LDLIBS)" ] || [ -z "$(AARCH64_RAY_SDL_LDLIBS)" ] || [ -z "$(AARCH64_RAY_SDL_INCLUDE_DIR)" ]; then \
|
||||
echo "AARCH64 cross-build variables are missing. Enter the flake shell with 'nix develop'."; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(MAKE) build-linux-arch \
|
||||
ARCH_NAME=aarch64 \
|
||||
LINUX_CC="$(AARCH64_CC)" \
|
||||
LINUX_AR="$(AARCH64_AR)" \
|
||||
LINUX_RAY_CFLAGS="$(AARCH64_RAY_CFLAGS)" \
|
||||
LINUX_RAY_LDLIBS="$(AARCH64_RAY_LDLIBS)" \
|
||||
LINUX_RAY_SDL_LDLIBS="$(AARCH64_RAY_SDL_LDLIBS)" \
|
||||
LINUX_RAY_SDL_INCLUDE_DIR="$(AARCH64_RAY_SDL_INCLUDE_DIR)"
|
||||
|
||||
build-linux-arch:
|
||||
@mkdir -p $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME) vendor/raylib/build/sdl-$(ARCH_NAME)
|
||||
$(MAKE) $(FONT_FILES)
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
$(MAKE) -j1 -C $(RAYLIB_DIR) \
|
||||
CC="$(LINUX_CC)" \
|
||||
AR="$(LINUX_AR)" \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL \
|
||||
GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC \
|
||||
RAYLIB_RELEASE_PATH=../build/sdl-$(ARCH_NAME) \
|
||||
RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=FALSE \
|
||||
SDL_INCLUDE_PATH="$(LINUX_RAY_SDL_INCLUDE_DIR)" \
|
||||
SDL_LIBRARIES="$(LINUX_RAY_SDL_LDLIBS)" \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(LINUX_RAY_CFLAGS) $(INBE_RAYLIB_CONFIG) -Os -ffunction-sections -fdata-sections"
|
||||
$(MAKE) -C $(RAYLIB_DIR) clean
|
||||
$(LINUX_CC) $(CFLAGS) -I$(INBE_DIR) -c $(INBE_DIR)/inbe.c -o $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/inbe.o
|
||||
$(LINUX_AR) rcs $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/libinbe.a $(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/inbe.o
|
||||
$(LINUX_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
$(FLINT_INCLUDE) \
|
||||
-Isrc -Isrc/android \
|
||||
$(LINUX_RAY_CFLAGS) \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-o $(LINUX_BUILD_DIR)/inbe-linux-$(ARCH_NAME) \
|
||||
$(SRC) \
|
||||
$(FLINT_SRCS) \
|
||||
$(LINUX_BUILD_DIR)/obj-$(ARCH_NAME)/libinbe.a \
|
||||
vendor/raylib/build/sdl-$(ARCH_NAME)/libraylib.a \
|
||||
$(LINUX_RAY_LDLIBS) \
|
||||
-lm -lpthread -ldl -lrt \
|
||||
$(LDFLAGS)
|
||||
@@ -0,0 +1,64 @@
|
||||
WEB_CC ?= emcc
|
||||
WEB_AR ?= emar
|
||||
WEB_TARGET = $(WEB_BUILD_DIR)/index.html
|
||||
WEB_RAYLIB_BUILD_DIR = $(WEB_BUILD_DIR)/raylib
|
||||
WEB_RAYLIB_A = $(WEB_RAYLIB_BUILD_DIR)/libraylib.web.a
|
||||
WEB_FLINT_SRCS = $(filter-out $(FLINT_DIR)/src/flint_file_dialog.c,$(FLINT_SRCS))
|
||||
WEB_RAYLIB_OBJS = \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rcore.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rshapes.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rtextures.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/rtext.o \
|
||||
$(WEB_RAYLIB_BUILD_DIR)/raudio.o
|
||||
WEB_CFLAGS = -Wall -Wextra -std=gnu99 -Os -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -D_DEFAULT_SOURCE -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1
|
||||
WEB_SHELL = src/web_shell.html
|
||||
WEB_SOUND_FILES = $(wildcard assets/sounds/*)
|
||||
WEB_FONT_FILES = $(FONT_FILES)
|
||||
WEB_LOCALE_PRELOADS = $(foreach file,$(LOCALE_FILES),--preload-file $(file)@locales/$(notdir $(file)))
|
||||
WEB_THEME_PRELOADS = $(foreach file,$(THEME_FILES),--preload-file $(file)@themes/$(notdir $(file)))
|
||||
WEB_SOUND_PRELOADS = $(foreach file,$(WEB_SOUND_FILES),--preload-file $(file)@assets/sounds/$(notdir $(file)))
|
||||
WEB_FONT_PRELOADS = $(foreach file,$(WEB_FONT_FILES),--preload-file $(file)@assets/fonts/$(notdir $(file)))
|
||||
WEB_ASSET_FILES = $(CONFIG_FILES) $(IMAGE_FILES) $(LOCALE_FILES) $(THEME_FILES) $(WEB_SOUND_FILES) $(WEB_FONT_FILES)
|
||||
WEB_LDFLAGS = -sUSE_GLFW=3 -sALLOW_MEMORY_GROWTH=1 -lidbfs.js --shell-file $(WEB_SHELL) $(WEB_LOCALE_PRELOADS) $(WEB_THEME_PRELOADS) $(WEB_SOUND_PRELOADS) $(WEB_FONT_PRELOADS) --preload-file [email protected] --preload-file [email protected] --preload-file assets/angel.jpg@assets/angel.jpg --preload-file assets/begin.jpg@assets/begin.jpg
|
||||
|
||||
$(WEB_RAYLIB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
web: $(WEB_TARGET)
|
||||
|
||||
$(WEB_RAYLIB_BUILD_DIR)/%.o: $(RAYLIB_DIR)/%.c | $(WEB_RAYLIB_BUILD_DIR)
|
||||
$(WEB_CC) \
|
||||
-c $< \
|
||||
-o $@ \
|
||||
-Wall \
|
||||
-D_GNU_SOURCE \
|
||||
-DPLATFORM_WEB \
|
||||
-DGRAPHICS_API_OPENGL_ES2 \
|
||||
-Wno-missing-braces \
|
||||
-Werror=pointer-arith \
|
||||
-fno-strict-aliasing \
|
||||
-std=gnu99 \
|
||||
-D_DEFAULT_SOURCE \
|
||||
$(INBE_RAYLIB_CONFIG) \
|
||||
-Os \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-I$(RAYLIB_DIR)
|
||||
|
||||
$(WEB_RAYLIB_A): $(RAYLIB_SOURCES) $(WEB_RAYLIB_OBJS)
|
||||
$(WEB_AR) rcs $@ $(WEB_RAYLIB_OBJS)
|
||||
|
||||
$(WEB_TARGET): $(BUILD_MAKEFILES) $(SRC) $(WEB_FLINT_SRCS) $(INBE_DIR)/inbe.c $(WEB_SHELL) $(WEB_RAYLIB_A) $(WEB_ASSET_FILES) | $(WEB_BUILD_DIR)
|
||||
$(WEB_CC) $(WEB_CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
$(FLINT_INCLUDE) \
|
||||
-Isrc -Isrc/android \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(WEB_FLINT_SRCS) \
|
||||
$(INBE_DIR)/inbe.c \
|
||||
$(WEB_RAYLIB_A) \
|
||||
$(WEB_LDFLAGS)
|
||||
cache_buster=$$(cksum $(WEB_BUILD_DIR)/index.js $(WEB_BUILD_DIR)/index.data $(WEB_BUILD_DIR)/index.wasm | cksum | cut -d ' ' -f 1); \
|
||||
sed -i "s#src=\"index.js\"#src=\"index.js?v=$$cache_buster\"#; s#WEB_CACHE_BUSTER#$$cache_buster#g" $(WEB_TARGET)
|
||||
@@ -0,0 +1,64 @@
|
||||
WIN_CC = x86_64-w64-mingw32-gcc
|
||||
WIN_AR = x86_64-w64-mingw32-ar
|
||||
WIN_WINDRES = x86_64-w64-mingw32-windres
|
||||
WIN_TARGET = $(WINDOWS_BUILD_DIR)/inbe-windows-x86_64.exe
|
||||
WIN_RAYLIB_BUILD_DIR = $(WINDOWS_BUILD_DIR)/raylib
|
||||
WIN_RAYLIB_A = $(WIN_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WIN_FLINT_SRCS = $(filter-out $(FLINT_DIR)/src/flint_file_dialog.c,$(FLINT_SRCS))
|
||||
WIN_RAYLIB_OBJS = \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rcore.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rshapes.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rtextures.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/rtext.o \
|
||||
$(WIN_RAYLIB_BUILD_DIR)/raudio.o
|
||||
WIN_INBE_A = $(WINDOWS_BUILD_DIR)/libinbe.a
|
||||
|
||||
$(WIN_RAYLIB_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
windows: $(WIN_TARGET)
|
||||
|
||||
$(WIN_RAYLIB_BUILD_DIR)/%.o: $(RAYLIB_DIR)/%.c | $(WIN_RAYLIB_BUILD_DIR)
|
||||
$(WIN_CC) \
|
||||
-c $< \
|
||||
-o $@ \
|
||||
-Wall \
|
||||
-D_GNU_SOURCE \
|
||||
-DPLATFORM_DESKTOP_WIN32 \
|
||||
-DGRAPHICS_API_OPENGL_33 \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-Wno-missing-braces \
|
||||
-Werror=pointer-arith \
|
||||
-fno-strict-aliasing \
|
||||
-std=gnu99 \
|
||||
-DUNICODE \
|
||||
$(INBE_RAYLIB_CONFIG) \
|
||||
-Os \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-I$(RAYLIB_DIR)
|
||||
|
||||
$(WIN_RAYLIB_A): $(RAYLIB_SOURCES) $(WIN_RAYLIB_OBJS)
|
||||
$(WIN_AR) rcs $@ $(WIN_RAYLIB_OBJS)
|
||||
|
||||
$(WIN_INBE_A): FORCE | $(WINDOWS_BUILD_DIR)
|
||||
$(MAKE) -C $(INBE_DIR) clean
|
||||
$(MAKE) -C $(INBE_DIR) CC=$(WIN_CC) AR=$(WIN_AR)
|
||||
cp $(INBE_A) $@
|
||||
|
||||
$(WIN_TARGET): $(SRC) $(WIN_FLINT_SRCS) $(FONT_FILES) $(WIN_RAYLIB_A) $(WIN_INBE_A) | $(WINDOWS_BUILD_DIR)
|
||||
$(WIN_CC) $(CFLAGS) \
|
||||
-I$(RAYLIB_DIR) \
|
||||
-I$(INBE_DIR) \
|
||||
$(FLINT_INCLUDE) \
|
||||
-Isrc -Isrc/android \
|
||||
-o $@ \
|
||||
$(SRC) \
|
||||
$(WIN_FLINT_SRCS) \
|
||||
$(WIN_INBE_A) \
|
||||
$(WIN_RAYLIB_A) \
|
||||
-L$(MCFGTHREADS)/lib \
|
||||
-lopengl32 -lgdi32 -lwinmm -lws2_32 \
|
||||
-mwindows \
|
||||
$(LDFLAGS)
|
||||
@@ -54,6 +54,9 @@ rsync -av --delete \
|
||||
--exclude='*.bak' \
|
||||
--exclude='*.swp' \
|
||||
--exclude='*.lock' \
|
||||
--exclude='assets' \
|
||||
--exclude='icons' \
|
||||
--exclude='site-icons' \
|
||||
--exclude='gradlew' \
|
||||
--exclude='gradlew.bat' \
|
||||
--exclude='shell.nix' \
|
||||
@@ -132,13 +135,7 @@ mkdir -p "$TMPDIR/tcl"
|
||||
mkdir -p "$TMPDIR/droid"
|
||||
[ -f "build/android/app-universal-release.apk" ] && cp build/android/app-universal-release.apk "$TMPDIR/droid/app-release.apk"
|
||||
|
||||
# Icons (cursors not used - deleted)
|
||||
rsync -av --exclude='.*' --exclude='*.sym' --exclude='*.o' --exclude='*.a' --exclude='build' --exclude='.gradle' --exclude='Makefile' --exclude='.npm' --exclude='.local' --exclude='.codex' icons/ "$TMPDIR/icons/"
|
||||
|
||||
rsync -av --exclude='*.sym' --exclude='*.o' --exclude='*.a' --exclude='build' --exclude='.gradle' --exclude='.npm' --exclude='.local' --exclude='.codex' cursors/ "$TMPDIR/cursors/"
|
||||
|
||||
cp style.css assets/DepartureMono-Regular.otf og.png sitemap.xml robots.txt "$TMPDIR/"
|
||||
cp -R assets "$TMPDIR/"
|
||||
cp style.css og.png sitemap.xml robots.txt "$TMPDIR/"
|
||||
|
||||
if [ -f "$TMPDIR/index.html" ]; then
|
||||
sed -e 's|/inbe/droid/app/build/outputs/apk/release/app-release.apk|/build/android/app-universal-release.apk|g' \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copy assets to Android project without requiring nix-shell or Makefile dependencies
|
||||
# This script is used by GitHub Actions and F-Droid builds
|
||||
# This script works from any directory by detecting the repository root
|
||||
@@ -37,15 +37,7 @@ cp locales/*.txt "$ASSETS_DIR/locales/"
|
||||
# Copy themes
|
||||
echo "Copying themes..."
|
||||
mkdir -p "$ASSETS_DIR/themes"
|
||||
cp themes/*.ini "$ASSETS_DIR/themes/"
|
||||
|
||||
# Copy icons
|
||||
echo "Copying icons..."
|
||||
mkdir -p "$ASSETS_DIR/icons"
|
||||
for icon in icons/*.png; do
|
||||
base=$(basename "$icon")
|
||||
cp "$icon" "$ASSETS_DIR/icons/$base"
|
||||
done
|
||||
cp vendor/flint/themes/*.ini "$ASSETS_DIR/themes/" 2>/dev/null || echo "No theme files found in vendor/flint/themes/"
|
||||
|
||||
# Copy images
|
||||
echo "Copying images..."
|
||||
@@ -57,4 +49,19 @@ echo "Copying sounds..."
|
||||
mkdir -p "$ASSETS_DIR/assets/sounds"
|
||||
cp assets/sounds/breath-in.ogg assets/sounds/breath-out.ogg assets/sounds/bell.ogg "$ASSETS_DIR/assets/sounds/"
|
||||
|
||||
# Build fonts only when explicitly requested. Android/F-Droid builds use the
|
||||
# committed glyph atlas so they do not need host build tools beyond Gradle.
|
||||
if [ "${INBE_REBUILD_FONTS:-0}" = "1" ]; then
|
||||
echo "Building fonts..."
|
||||
mkdir -p assets/fonts
|
||||
make -C vendor/otfchop otfchop
|
||||
vendor/otfchop/otfchop vendor/otfchop/unifont-17.0.04.otf locales/*.txt assets/fonts/locales
|
||||
else
|
||||
echo "Using versioned fonts..."
|
||||
fi
|
||||
|
||||
echo "Copying fonts..."
|
||||
mkdir -p "$ASSETS_DIR/assets/fonts"
|
||||
cp assets/fonts/locales.png assets/fonts/locales.dat "$ASSETS_DIR/assets/fonts/"
|
||||
|
||||
echo "Assets copied successfully!"
|
||||
@@ -9,5 +9,7 @@ dark_mode 0
|
||||
fullscreen 0
|
||||
on_screen_keyboard 1
|
||||
progressive_speed 1
|
||||
progressive_start_speed 3
|
||||
advanced_session_controls 1
|
||||
hold_display_mode 0
|
||||
language en
|
||||
@@ -0,0 +1,139 @@
|
||||
#include "android_import.h"
|
||||
|
||||
#include "raylib.h"
|
||||
#include <string.h>
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
#include <android/native_activity.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#include <pthread.h>
|
||||
|
||||
extern struct android_app *GetAndroidApp(void);
|
||||
|
||||
#define ANDROID_IMPORT_PATH_MAX 512
|
||||
|
||||
static pthread_mutex_t import_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int pending_result = ANDROID_IMPORT_RESULT_NONE;
|
||||
static char pending_path[ANDROID_IMPORT_PATH_MAX];
|
||||
|
||||
static void
|
||||
android_import_set_result(int result, const char *path)
|
||||
{
|
||||
pthread_mutex_lock(&import_mutex);
|
||||
pending_result = result;
|
||||
if(path != NULL) {
|
||||
strncpy(pending_path, path, sizeof(pending_path) - 1);
|
||||
pending_path[sizeof(pending_path) - 1] = '\0';
|
||||
} else {
|
||||
pending_path[0] = '\0';
|
||||
}
|
||||
pthread_mutex_unlock(&import_mutex);
|
||||
}
|
||||
|
||||
int
|
||||
android_import_open_picker(void)
|
||||
{
|
||||
struct android_app *app = GetAndroidApp();
|
||||
if(app == NULL || app->activity == NULL) {
|
||||
TraceLog(LOG_ERROR, "ANDROID_IMPORT: GetAndroidApp failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ANativeActivity *activity = app->activity;
|
||||
JavaVM *jvm = activity->vm;
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
if((*jvm)->AttachCurrentThread(jvm, &env, NULL) != JNI_OK) {
|
||||
TraceLog(LOG_ERROR, "ANDROID_IMPORT: failed to attach thread");
|
||||
return 0;
|
||||
}
|
||||
|
||||
jclass activity_class = (*env)->GetObjectClass(env, activity->clazz);
|
||||
if(activity_class == NULL) {
|
||||
TraceLog(LOG_ERROR, "ANDROID_IMPORT: MainActivity class not found");
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
jmethodID method = (*env)->GetMethodID(env, activity_class, "openImportPicker", "()V");
|
||||
if(method == NULL) {
|
||||
TraceLog(LOG_ERROR, "ANDROID_IMPORT: openImportPicker method not found");
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, activity->clazz, method);
|
||||
if((*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
TraceLog(LOG_INFO, "ANDROID_IMPORT: file picker opened");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
android_import_native_selected(JNIEnv *env, jobject thiz, jstring path)
|
||||
{
|
||||
(void)thiz;
|
||||
if(path == NULL) {
|
||||
android_import_set_result(ANDROID_IMPORT_RESULT_SELECTED, "");
|
||||
return;
|
||||
}
|
||||
|
||||
const char *import_path = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if(import_path == NULL || import_path[0] == '\0') {
|
||||
if(import_path != NULL)
|
||||
(*env)->ReleaseStringUTFChars(env, path, import_path);
|
||||
android_import_set_result(ANDROID_IMPORT_RESULT_SELECTED, "");
|
||||
return;
|
||||
}
|
||||
|
||||
android_import_set_result(ANDROID_IMPORT_RESULT_SELECTED, import_path);
|
||||
(*env)->ReleaseStringUTFChars(env, path, import_path);
|
||||
}
|
||||
|
||||
void
|
||||
android_import_native_cancelled(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
android_import_set_result(ANDROID_IMPORT_RESULT_CANCELLED, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
android_import_poll_result(char *path, size_t path_size)
|
||||
{
|
||||
int result;
|
||||
|
||||
pthread_mutex_lock(&import_mutex);
|
||||
result = pending_result;
|
||||
if(path != NULL && path_size > 0) {
|
||||
strncpy(path, pending_path, path_size - 1);
|
||||
path[path_size - 1] = '\0';
|
||||
}
|
||||
pending_result = ANDROID_IMPORT_RESULT_NONE;
|
||||
pending_path[0] = '\0';
|
||||
pthread_mutex_unlock(&import_mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
int
|
||||
android_import_open_picker(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
android_import_poll_result(char *path, size_t path_size)
|
||||
{
|
||||
if(path != NULL && path_size > 0)
|
||||
path[0] = '\0';
|
||||
return ANDROID_IMPORT_RESULT_NONE;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef ANDROID_IMPORT_H
|
||||
#define ANDROID_IMPORT_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
int android_import_open_picker(void);
|
||||
int android_import_poll_result(char *path, size_t path_size);
|
||||
|
||||
enum {
|
||||
ANDROID_IMPORT_RESULT_NONE = 0,
|
||||
ANDROID_IMPORT_RESULT_SELECTED = 1,
|
||||
ANDROID_IMPORT_RESULT_CANCELLED = 2
|
||||
};
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
#include <jni.h>
|
||||
void android_import_native_selected(JNIEnv *env, jobject thiz, jstring path);
|
||||
void android_import_native_cancelled(JNIEnv *env, jobject thiz);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "android_insets.h"
|
||||
#include "android_import.h"
|
||||
#include "android_timer.h"
|
||||
#include "android_wakelock.h"
|
||||
#include "app.h"
|
||||
@@ -179,6 +180,8 @@ static const JNINativeMethod g_methods[] = {
|
||||
{"nativeGetPlayInBackground", "()I", (void*)nativeGetPlayInBackground},
|
||||
{"nativePauseSession", "()V", (void*)nativePauseSession},
|
||||
{"nativeResumeSession", "()V", (void*)nativeResumeSession},
|
||||
{"nativeImportSelectedFile", "(Ljava/lang/String;)V", (void*)android_import_native_selected},
|
||||
{"nativeImportCancelled", "()V", (void*)android_import_native_cancelled},
|
||||
};
|
||||
|
||||
// JNI_OnLoad - Register native methods
|
||||
|
||||
@@ -14,6 +14,8 @@ static JavaVM *g_jvm = NULL;
|
||||
static jobject g_activity = NULL;
|
||||
static jmethodID g_acquire_method = NULL;
|
||||
static jmethodID g_release_method = NULL;
|
||||
static jmethodID g_keep_screen_on_method = NULL;
|
||||
static jmethodID g_allow_screen_off_method = NULL;
|
||||
static pthread_mutex_t wakelock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
void android_wakelock_init(void) {
|
||||
@@ -34,6 +36,8 @@ void android_wakelock_set_activity(JNIEnv *env, jobject activity) {
|
||||
if (clazz) {
|
||||
g_acquire_method = (*env)->GetMethodID(env, clazz, "acquireWakeLock", "()V");
|
||||
g_release_method = (*env)->GetMethodID(env, clazz, "releaseWakeLock", "()V");
|
||||
g_keep_screen_on_method = (*env)->GetMethodID(env, clazz, "keepScreenOn", "()V");
|
||||
g_allow_screen_off_method = (*env)->GetMethodID(env, clazz, "allowScreenOff", "()V");
|
||||
(*env)->DeleteLocalRef(env, clazz);
|
||||
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "Wake lock activity set successfully");
|
||||
}
|
||||
@@ -104,6 +108,52 @@ void android_wakelock_release(void) {
|
||||
TraceLog(LOG_INFO, "INBE: Wake lock released");
|
||||
}
|
||||
|
||||
void android_keep_screen_on(void) {
|
||||
pthread_mutex_lock(&wakelock_mutex);
|
||||
|
||||
if (!g_jvm || !g_activity) {
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "KEEP_SCREEN_ON: JNI not initialized - skipping");
|
||||
pthread_mutex_unlock(&wakelock_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv *env = NULL;
|
||||
jint result = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
|
||||
if (result == JNI_EDETACHED) {
|
||||
result = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
|
||||
}
|
||||
|
||||
if (env && g_keep_screen_on_method) {
|
||||
(*env)->CallVoidMethod(env, g_activity, g_keep_screen_on_method);
|
||||
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "KEEP_SCREEN_ON: SUCCESS");
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&wakelock_mutex);
|
||||
}
|
||||
|
||||
void android_allow_screen_off(void) {
|
||||
pthread_mutex_lock(&wakelock_mutex);
|
||||
|
||||
if (!g_jvm || !g_activity) {
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "ALLOW_SCREEN_OFF: JNI not initialized - skipping");
|
||||
pthread_mutex_unlock(&wakelock_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv *env = NULL;
|
||||
jint result = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
|
||||
if (result == JNI_EDETACHED) {
|
||||
result = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
|
||||
}
|
||||
|
||||
if (env && g_allow_screen_off_method) {
|
||||
(*env)->CallVoidMethod(env, g_activity, g_allow_screen_off_method);
|
||||
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "ALLOW_SCREEN_OFF: SUCCESS");
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&wakelock_mutex);
|
||||
}
|
||||
|
||||
// Called from JNI to set the JVM reference
|
||||
void android_wakelock_set_jvm(JavaVM *vm) {
|
||||
g_jvm = vm;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
void android_wakelock_init(void);
|
||||
void android_wakelock_acquire(void);
|
||||
void android_wakelock_release(void);
|
||||
void android_keep_screen_on(void);
|
||||
void android_allow_screen_off(void);
|
||||
void android_wakelock_set_activity(JNIEnv *env, jobject activity);
|
||||
void android_wakelock_set_jvm(JavaVM *vm);
|
||||
#else
|
||||
@@ -13,6 +15,8 @@ void android_wakelock_set_jvm(JavaVM *vm);
|
||||
static inline void android_wakelock_init(void) {}
|
||||
static inline void android_wakelock_acquire(void) {}
|
||||
static inline void android_wakelock_release(void) {}
|
||||
static inline void android_keep_screen_on(void) {}
|
||||
static inline void android_allow_screen_off(void) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
#include "raylib.h"
|
||||
#include "../libinbe/inbe.h"
|
||||
|
||||
typedef struct TextLayout TextLayout;
|
||||
|
||||
|
||||
#include "flint_text_layout.h"
|
||||
#include "app_fwd.h"
|
||||
|
||||
enum {
|
||||
SETTINGS_SPEED_MIN = 1,
|
||||
SETTINGS_SPEED_MAX = 16,
|
||||
SETTINGS_SPEED_MAX = 12,
|
||||
SETTINGS_BREATHS_MIN = 15,
|
||||
SETTINGS_BREATHS_MAX = 80,
|
||||
SETTINGS_PAUSE_MIN = 0,
|
||||
@@ -107,7 +105,10 @@ typedef struct LotusAppApi {
|
||||
void (*destroy)(void *state);
|
||||
} LotusAppApi;
|
||||
|
||||
typedef struct InbeApp InbeApp;
|
||||
typedef enum HoldDisplayMode {
|
||||
HOLD_DISPLAY_CIRCLE = 0,
|
||||
HOLD_DISPLAY_STOPWATCH = 1,
|
||||
} HoldDisplayMode;
|
||||
|
||||
struct InbeApp {
|
||||
Inbe inbe;
|
||||
@@ -127,12 +128,19 @@ struct InbeApp {
|
||||
Texture2D trash_icon;
|
||||
Texture2D pencil_icon;
|
||||
Texture2D save_icon;
|
||||
Texture2D discord_icon;
|
||||
Texture2D telegram_icon;
|
||||
Texture2D globe_icon;
|
||||
Texture2D monero_icon;
|
||||
Texture2D sound0_icon;
|
||||
Texture2D sound1_icon;
|
||||
Texture2D sound2_icon;
|
||||
Texture2D sound3_icon;
|
||||
|
||||
Texture2D angel_image;
|
||||
Texture2D begin_image;
|
||||
Texture2D font_shapes_texture;
|
||||
Font locale_font;
|
||||
Sound breath_in_sound;
|
||||
Sound breath_out_sound;
|
||||
Sound bell_sound;
|
||||
@@ -166,7 +174,7 @@ struct InbeApp {
|
||||
int tutorial_step;
|
||||
int tutorial_seen;
|
||||
|
||||
TextLayout *tutorial_layouts[6];
|
||||
FlintTextLayout *tutorial_layouts[6];
|
||||
int tutorial_layouts_initialized;
|
||||
|
||||
int theme_id;
|
||||
@@ -193,10 +201,13 @@ struct InbeApp {
|
||||
int history_delete_round;
|
||||
char history_delete_path[FS_PATH_MAX];
|
||||
int advanced_session_controls;
|
||||
int hold_display_mode;
|
||||
int session_paused;
|
||||
int backgrounded;
|
||||
int results_saved;
|
||||
char results_path[FS_PATH_MAX];
|
||||
int saved_pause_seconds;
|
||||
int volume_popup_active;
|
||||
UIModal modal;
|
||||
};
|
||||
|
||||
@@ -216,5 +227,6 @@ void refresh_theme_colors(int theme_id, int dark_mode);
|
||||
void refresh_locale_dependent_text(InbeApp *app);
|
||||
void apply_language_selection(InbeApp *app, int language_index, int save_now);
|
||||
void draw_preview_inbe(Inbe *inbe, int center_x, int center_y);
|
||||
int draw_hold_display_mode_selector(InbeApp *app, int x, int y, int w);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef INBE_APP_FWD_H
|
||||
#define INBE_APP_FWD_H
|
||||
|
||||
typedef struct InbeApp InbeApp;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,857 @@
|
||||
#include "app_session.h"
|
||||
|
||||
#include "data.h"
|
||||
#include "locale.h"
|
||||
#include "flint_dpi.h"
|
||||
#include "flint_ui.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android_timer.h"
|
||||
#include "android_wakelock.h"
|
||||
void set_global_inbe_app(InbeApp *app);
|
||||
#endif
|
||||
|
||||
extern int view_width;
|
||||
extern int view_height;
|
||||
extern Color c_text, c_bg, c_circle, c_button, c_button_hover, c_icon;
|
||||
|
||||
static void
|
||||
set_circle_bounds(Inbe *inbe, int rmin, int rmax)
|
||||
{
|
||||
int old_rmin;
|
||||
int old_rmax;
|
||||
int old_span;
|
||||
int new_span;
|
||||
|
||||
if(inbe == NULL)
|
||||
return;
|
||||
|
||||
if(rmin < 8)
|
||||
rmin = 8;
|
||||
if(rmax < rmin + 8)
|
||||
rmax = rmin + 8;
|
||||
|
||||
old_rmin = inbe->rmin;
|
||||
old_rmax = inbe->rmax;
|
||||
old_span = old_rmax - old_rmin;
|
||||
new_span = rmax - rmin;
|
||||
|
||||
if(old_span > 0) {
|
||||
float t = (float)(inbe->r - old_rmin) / (float)old_span;
|
||||
|
||||
if(t < 0.0f)
|
||||
t = 0.0f;
|
||||
if(t > 1.0f)
|
||||
t = 1.0f;
|
||||
|
||||
inbe->r = rmin + t * (float)new_span;
|
||||
} else {
|
||||
inbe->r = rmin;
|
||||
}
|
||||
|
||||
inbe->rmin = rmin;
|
||||
inbe->rmax = rmax;
|
||||
if(inbe->r < rmin)
|
||||
inbe->r = rmin;
|
||||
if(inbe->r > rmax)
|
||||
inbe->r = rmax;
|
||||
}
|
||||
|
||||
void
|
||||
session_update_circle_bounds_for_view(Inbe *inbe, int top_reserve, int bottom_reserve)
|
||||
{
|
||||
int available_w = view_width - CIRCLE_SIDE_PAD * 2;
|
||||
int available_h = view_height - top_reserve - bottom_reserve - CIRCLE_SIDE_PAD * 2;
|
||||
int rmax;
|
||||
int rmin;
|
||||
|
||||
if(available_w < 0)
|
||||
available_w = 0;
|
||||
if(available_h < 0)
|
||||
available_h = 0;
|
||||
|
||||
rmax = available_w / 2;
|
||||
if(available_h / 2 < rmax)
|
||||
rmax = available_h / 2;
|
||||
if(rmax < 24)
|
||||
rmax = 24;
|
||||
|
||||
rmin = rmax / 2;
|
||||
if(rmin < 16)
|
||||
rmin = 16;
|
||||
if(rmin > rmax - 8)
|
||||
rmin = rmax - 8;
|
||||
set_circle_bounds(inbe, rmin, rmax);
|
||||
}
|
||||
|
||||
void
|
||||
update_preview_bounds(Inbe *inbe, int content_w, int content_h)
|
||||
{
|
||||
int span = content_w;
|
||||
int rmax;
|
||||
int rmin;
|
||||
|
||||
if(content_h > 0 && content_h < span)
|
||||
span = content_h;
|
||||
|
||||
rmax = span / 2;
|
||||
if(rmax < flint_px(60))
|
||||
rmax = flint_px(60);
|
||||
if(rmax > flint_px(120))
|
||||
rmax = flint_px(120);
|
||||
rmin = rmax / 2;
|
||||
if(rmin < flint_px(24))
|
||||
rmin = flint_px(24);
|
||||
if(rmin > rmax - flint_px(10))
|
||||
rmin = rmax - flint_px(10);
|
||||
set_circle_bounds(inbe, rmin, rmax);
|
||||
}
|
||||
|
||||
void
|
||||
session_reset_round_breathe(Inbe *inbe)
|
||||
{
|
||||
inbe->phase = InbePhaseBreathe;
|
||||
inbe->dir = 0;
|
||||
inbe->r = inbe->rmin;
|
||||
inbe->breath_frame = 0;
|
||||
inbe->breathtick = 0;
|
||||
inbe->sectick = 0;
|
||||
inbe->halftick = 0;
|
||||
cpcount(inbe->count, "000");
|
||||
}
|
||||
|
||||
static void
|
||||
reset_round_start(Inbe *inbe)
|
||||
{
|
||||
session_reset_round_breathe(inbe);
|
||||
if(inbe->pause_seconds > 0)
|
||||
inbe->phase = InbePhaseStarting;
|
||||
}
|
||||
|
||||
static void
|
||||
remember_sound_state(InbeApp *app)
|
||||
{
|
||||
if(app == NULL)
|
||||
return;
|
||||
|
||||
app->sound_last_screen = app->inbe.screen;
|
||||
app->sound_last_phase = app->inbe.phase;
|
||||
app->sound_last_dir = app->inbe.dir;
|
||||
cpcount(app->sound_last_count, app->inbe.count);
|
||||
}
|
||||
|
||||
static void
|
||||
play_app_sound(InbeApp *app, Sound sound, float scale)
|
||||
{
|
||||
float volume;
|
||||
|
||||
if(app == NULL || !app->audio_ready || sound.frameCount == 0 || app->sound_volume <= 0)
|
||||
return;
|
||||
|
||||
volume = ((float)app->sound_volume / 100.0f) * scale;
|
||||
if(volume < 0.0f)
|
||||
volume = 0.0f;
|
||||
if(volume > 1.0f)
|
||||
volume = 1.0f;
|
||||
|
||||
StopSound(sound);
|
||||
SetSoundVolume(sound, volume);
|
||||
PlaySound(sound);
|
||||
}
|
||||
|
||||
void
|
||||
update_session_sounds(InbeApp *app)
|
||||
{
|
||||
if(app == NULL)
|
||||
return;
|
||||
|
||||
if(app->inbe.screen != InbeScreenSession ||
|
||||
(app->session_paused && !(app->backgrounded && app->inbe.play_in_background))) {
|
||||
remember_sound_state(app);
|
||||
return;
|
||||
}
|
||||
|
||||
int screen_changed = app->sound_last_screen != InbeScreenSession;
|
||||
int phase_changed = app->sound_last_phase != app->inbe.phase;
|
||||
int dir_changed = app->sound_last_dir != app->inbe.dir;
|
||||
int count_changed = !(app->sound_last_count[0] == app->inbe.count[0] &&
|
||||
app->sound_last_count[1] == app->inbe.count[1] &&
|
||||
app->sound_last_count[2] == app->inbe.count[2]);
|
||||
|
||||
if(app->inbe.phase == InbePhaseBreathe) {
|
||||
if(screen_changed || phase_changed || dir_changed) {
|
||||
Sound breath_snd = app->inbe.dir == 0 ? app->breath_in_sound : app->breath_out_sound;
|
||||
play_app_sound(app, breath_snd, 1.0f);
|
||||
}
|
||||
if(count_changed) {
|
||||
int count_value = int_from_count(app->inbe.count);
|
||||
int maxbreaths_value = int_from_count(app->inbe.maxbreaths);
|
||||
if(count_value == maxbreaths_value - 1)
|
||||
play_app_sound(app, app->bell_sound, 0.8f);
|
||||
}
|
||||
} else if(phase_changed) {
|
||||
if(app->inbe.phase == InbePhaseNext && app->sound_last_phase == InbePhaseRecover)
|
||||
play_app_sound(app, app->breath_out_sound, 1.0f);
|
||||
}
|
||||
|
||||
remember_sound_state(app);
|
||||
}
|
||||
|
||||
void
|
||||
session_start(InbeApp *app)
|
||||
{
|
||||
int speed = app->inbe.speed_level;
|
||||
int max_rounds = app->inbe.max_rounds;
|
||||
int max_breaths = int_from_count(app->inbe.maxbreaths);
|
||||
int pause_seconds = app->inbe.pause_seconds;
|
||||
int progressive_speed = app->inbe.progressive_speed;
|
||||
int progressive_start_speed = app->inbe.progressive_start_speed;
|
||||
int play_in_background = app->inbe.play_in_background;
|
||||
|
||||
inbeinit(&app->inbe);
|
||||
app->inbe.progressive_speed = progressive_speed;
|
||||
app->inbe.progressive_start_speed = progressive_start_speed;
|
||||
app->inbe.play_in_background = play_in_background;
|
||||
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
|
||||
app->saved_pause_seconds = app->inbe.pause_seconds;
|
||||
app->inbe.pause_seconds = 3;
|
||||
session_update_circle_bounds_for_view(&app->inbe, 0, flint_px(56) + 80);
|
||||
app->inbe.screen = InbeScreenSession;
|
||||
app->session_paused = 0;
|
||||
app->results_saved = 0;
|
||||
app->results_path[0] = '\0';
|
||||
remember_sound_state(app);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
android_keep_screen_on();
|
||||
TraceLog(LOG_INFO, "INBE: Starting session - play_in_background = %d", app->inbe.play_in_background);
|
||||
if(app->inbe.play_in_background) {
|
||||
android_wakelock_acquire();
|
||||
android_timer_set_app(app);
|
||||
set_global_inbe_app(app);
|
||||
android_timer_start();
|
||||
} else {
|
||||
set_global_inbe_app(app);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
collect_result_rounds(InbeApp *app, int *round_times, int max_rounds)
|
||||
{
|
||||
int rounds;
|
||||
int count = 0;
|
||||
|
||||
if(app == NULL || round_times == NULL || max_rounds <= 0)
|
||||
return 0;
|
||||
|
||||
rounds = app->inbe.round + 1;
|
||||
if(rounds < 1)
|
||||
rounds = 1;
|
||||
if(rounds > app->inbe.max_rounds)
|
||||
rounds = app->inbe.max_rounds;
|
||||
if(rounds > max_rounds)
|
||||
rounds = max_rounds;
|
||||
|
||||
for(int i = 0; i < rounds; i++) {
|
||||
int seconds = int_from_count(app->inbe.results[i]);
|
||||
if(seconds > 0)
|
||||
round_times[count++] = seconds;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int
|
||||
session_ensure_results_saved(InbeApp *app)
|
||||
{
|
||||
int round_times[MaxRounds];
|
||||
int rounds;
|
||||
|
||||
if(app == NULL)
|
||||
return 0;
|
||||
if(app->results_saved)
|
||||
return 1;
|
||||
|
||||
rounds = collect_result_rounds(app, round_times, MaxRounds);
|
||||
if(rounds <= 0)
|
||||
return 0;
|
||||
|
||||
if(data_save_session_path(round_times, rounds, app->results_path, sizeof(app->results_path))) {
|
||||
app->results_saved = 1;
|
||||
TraceLog(LOG_INFO, "INBE: session saved successfully");
|
||||
return 1;
|
||||
}
|
||||
|
||||
TraceLog(LOG_WARNING, "INBE: session save failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
session_discard_saved_results(InbeApp *app)
|
||||
{
|
||||
if(app == NULL)
|
||||
return;
|
||||
|
||||
if(app->results_saved && app->results_path[0] != '\0') {
|
||||
if(data_delete_session(app->results_path)) {
|
||||
app->results_saved = 0;
|
||||
app->results_path[0] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
session_has_completed_rounds(InbeApp *app)
|
||||
{
|
||||
int round_times[MaxRounds];
|
||||
return collect_result_rounds(app, round_times, MaxRounds) > 0;
|
||||
}
|
||||
|
||||
static void
|
||||
finish_hold(InbeApp *app)
|
||||
{
|
||||
cpcount(app->inbe.results[app->inbe.round], app->inbe.count);
|
||||
cpcount(app->inbe.count, "000");
|
||||
app->inbe.phase = InbePhaseRecover;
|
||||
app->inbe.r = app->inbe.rmin;
|
||||
app->inbe.breath_frame = 0;
|
||||
app->inbe.breathtick = 0;
|
||||
app->inbe.sectick = 0;
|
||||
play_app_sound(app, app->breath_in_sound, 1.0f);
|
||||
}
|
||||
|
||||
static void
|
||||
finish_round(InbeApp *app)
|
||||
{
|
||||
app->inbe.breathtick = 0;
|
||||
app->inbe.sectick = 0;
|
||||
cpcount(app->inbe.count, "000");
|
||||
|
||||
if(app->inbe.round < app->inbe.max_rounds - 1) {
|
||||
app->inbe.round++;
|
||||
if(app->inbe.round == 1)
|
||||
app->inbe.pause_seconds = app->saved_pause_seconds;
|
||||
reset_round_start(&app->inbe);
|
||||
} else {
|
||||
if(session_ensure_results_saved(app)) {
|
||||
#ifdef __ANDROID__
|
||||
android_allow_screen_off();
|
||||
#endif
|
||||
app->inbe.screen = InbeScreenResults;
|
||||
} else {
|
||||
inbe_app_init(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
session_step_back(InbeApp *app)
|
||||
{
|
||||
int speed = app->inbe.speed_level;
|
||||
int max_rounds = app->inbe.max_rounds;
|
||||
int max_breaths = int_from_count(app->inbe.maxbreaths);
|
||||
int pause_seconds = app->saved_pause_seconds;
|
||||
int progressive_speed = app->inbe.progressive_speed;
|
||||
int progressive_start_speed = app->inbe.progressive_start_speed;
|
||||
int play_in_background = app->inbe.play_in_background;
|
||||
|
||||
inbeinit(&app->inbe);
|
||||
app->inbe.progressive_speed = progressive_speed;
|
||||
app->inbe.progressive_start_speed = progressive_start_speed;
|
||||
app->inbe.play_in_background = play_in_background;
|
||||
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
|
||||
app->saved_pause_seconds = pause_seconds;
|
||||
app->inbe.pause_seconds = 3;
|
||||
session_update_circle_bounds_for_view(&app->inbe, 0, flint_px(56) + 80);
|
||||
app->inbe.screen = InbeScreenSession;
|
||||
app->session_paused = 0;
|
||||
app->results_saved = 0;
|
||||
app->results_path[0] = '\0';
|
||||
remember_sound_state(app);
|
||||
}
|
||||
|
||||
static void
|
||||
session_step_forward(InbeApp *app)
|
||||
{
|
||||
switch(app->inbe.phase) {
|
||||
case InbePhaseStarting:
|
||||
session_reset_round_breathe(&app->inbe);
|
||||
break;
|
||||
case InbePhaseBreathe:
|
||||
app->inbe.phase = InbePhaseHold;
|
||||
app->inbe.r = app->inbe.rmin;
|
||||
app->inbe.breath_frame = 0;
|
||||
app->inbe.breathtick = 0;
|
||||
app->inbe.sectick = 0;
|
||||
cpcount(app->inbe.count, "000");
|
||||
break;
|
||||
case InbePhaseHold:
|
||||
finish_hold(app);
|
||||
break;
|
||||
case InbePhaseRecover:
|
||||
app->inbe.phase = InbePhaseNext;
|
||||
app->inbe.breath_frame = 0;
|
||||
app->inbe.sectick = 0;
|
||||
cpcount(app->inbe.count, "000");
|
||||
break;
|
||||
case InbePhaseNext:
|
||||
finish_round(app);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
draw_session_counter(InbeApp *app, int center_x, int center_y)
|
||||
{
|
||||
char text[CountSize];
|
||||
int count;
|
||||
int font = flint_px(16);
|
||||
|
||||
if(app->inbe.phase == InbePhaseRecover) {
|
||||
if(app->inbe.r < app->inbe.rmax) {
|
||||
flint_ui_draw_text_centered("000", center_x, center_y, font, c_text);
|
||||
return;
|
||||
}
|
||||
|
||||
count = int_from_count(app->inbe.count);
|
||||
if(count < 15) {
|
||||
count_from_int(text, 15 - count);
|
||||
flint_ui_draw_text_centered(text, center_x, center_y, font, c_text);
|
||||
return;
|
||||
}
|
||||
flint_ui_draw_text_centered("000", center_x, center_y, font, c_text);
|
||||
return;
|
||||
}
|
||||
|
||||
if(app->inbe.phase == InbePhaseNext) {
|
||||
flint_ui_draw_text_centered("000", center_x, center_y, font, c_text);
|
||||
return;
|
||||
}
|
||||
|
||||
flint_ui_draw_text_centered(app->inbe.count, center_x, center_y, font, c_text);
|
||||
}
|
||||
|
||||
int
|
||||
draw_hold_display_mode_selector(InbeApp *app, int x, int y, int w)
|
||||
{
|
||||
const char *labels[2] = {locale_get("hold_display_circle"), locale_get("hold_display_stopwatch")};
|
||||
int selected = clampi(app->hold_display_mode, HOLD_DISPLAY_CIRCLE, HOLD_DISPLAY_STOPWATCH);
|
||||
int h = flint_px(36);
|
||||
int segment_w = w / 2;
|
||||
int clicked = 0;
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
int segment_x = x + i * segment_w;
|
||||
int current_w = i == 1 ? x + w - segment_x : segment_w;
|
||||
Rectangle rect = {segment_x, y, current_w, h};
|
||||
int hovered = CheckCollisionPointRec(mouse_world, rect);
|
||||
int active = i == selected;
|
||||
Color fill = active ? c_button : flint_darken(c_bg, 10);
|
||||
Color top = flint_lighten(fill, 35);
|
||||
Color bottom = flint_darken(fill, 45);
|
||||
int font = flint_ui_font();
|
||||
int text_w;
|
||||
|
||||
if(hovered) {
|
||||
app->cursor_clickable = 1;
|
||||
if(!active) {
|
||||
fill = c_button_hover;
|
||||
top = flint_darken(c_button_hover, 40);
|
||||
bottom = flint_lighten(c_button_hover, 40);
|
||||
}
|
||||
}
|
||||
|
||||
DrawRectangle(segment_x, y, current_w, h, fill);
|
||||
ui_draw_bevel(segment_x, y, current_w, h, top, bottom);
|
||||
|
||||
while(font > flint_px(11) && flint_text_measure(labels[i], font) > current_w - flint_px(12))
|
||||
font--;
|
||||
text_w = flint_text_measure(labels[i], font);
|
||||
flint_text_draw(labels[i], segment_x + (current_w - text_w) / 2,
|
||||
flint_ui_text_y(labels[i], y, h, font), font, c_text);
|
||||
|
||||
if(hovered && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) &&
|
||||
!ui_dropdown_captures_click(mouse_world) && selected != i) {
|
||||
app->hold_display_mode = i == 0 ? HOLD_DISPLAY_CIRCLE : HOLD_DISPLAY_STOPWATCH;
|
||||
app->settings_dirty = 1;
|
||||
clicked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return clicked;
|
||||
}
|
||||
|
||||
static void
|
||||
draw_hold_progress_outline(InbeApp *app, int center_x, int center_y)
|
||||
{
|
||||
int seconds = int_from_count(app->inbe.count);
|
||||
int total_frames = seconds * 60 + app->inbe.sectick;
|
||||
int minute_frames = 60 * 60;
|
||||
int completed_minutes = total_frames / minute_frames;
|
||||
int frame_in_minute = total_frames % minute_frames;
|
||||
float sweep = 360.0f * (float)frame_in_minute / (float)minute_frames;
|
||||
int thickness = flint_px(5);
|
||||
int gap = flint_px(18);
|
||||
int radius = app->inbe.r + flint_px(12);
|
||||
int min_radius = app->inbe.r / 2;
|
||||
|
||||
if(thickness < 3)
|
||||
thickness = 3;
|
||||
if(min_radius < flint_px(16))
|
||||
min_radius = flint_px(16);
|
||||
|
||||
for(int i = 0; i <= completed_minutes; i++) {
|
||||
int ring_radius = radius - i * gap;
|
||||
if(ring_radius <= min_radius)
|
||||
break;
|
||||
|
||||
if(i < completed_minutes) {
|
||||
DrawRing((Vector2){center_x, center_y}, (float)(ring_radius - thickness / 2),
|
||||
(float)(ring_radius + thickness / 2), -90.0f, 270.0f, 96, c_text);
|
||||
} else if(sweep > 0.0f) {
|
||||
DrawRing((Vector2){center_x, center_y}, (float)(ring_radius - thickness / 2),
|
||||
(float)(ring_radius + thickness / 2), -90.0f, -90.0f + sweep, 96, c_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
session_draw_inbe(InbeApp *app, int center_x, int center_y)
|
||||
{
|
||||
if(app->inbe.phase == InbePhaseHold && app->hold_display_mode == HOLD_DISPLAY_CIRCLE) {
|
||||
draw_hold_progress_outline(app, center_x, center_y);
|
||||
} else {
|
||||
DrawCircle(center_x, center_y, app->inbe.r, c_circle);
|
||||
DrawCircleLines(center_x, center_y, app->inbe.r, c_text);
|
||||
}
|
||||
draw_session_counter(app, center_x, center_y);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_session_status(InbeApp *app, int center_x, int center_y)
|
||||
{
|
||||
char text[32];
|
||||
char max_text[32];
|
||||
int total_seconds;
|
||||
int remaining;
|
||||
int max_text_w;
|
||||
int text_y;
|
||||
int font = flint_px(16);
|
||||
|
||||
if(app->inbe.phase != InbePhaseStarting)
|
||||
return;
|
||||
|
||||
total_seconds = app->inbe.round == 0 ? 3 : app->inbe.pause_seconds;
|
||||
if(total_seconds <= 0)
|
||||
return;
|
||||
|
||||
remaining = total_seconds - app->inbe.sectick / 60;
|
||||
if(remaining < 1)
|
||||
remaining = 1;
|
||||
|
||||
locale_format(max_text, sizeof(max_text), "starting_in", 30);
|
||||
max_text_w = flint_text_measure(max_text, font);
|
||||
locale_format(text, sizeof(text), "starting_in", remaining);
|
||||
text_y = center_y - (int)(app->inbe.rmax * 0.72f) - flint_px(40);
|
||||
if(text_y < flint_px(20))
|
||||
text_y = flint_px(20);
|
||||
flint_text_draw(text, center_x - max_text_w / 2, text_y, font, c_text);
|
||||
}
|
||||
|
||||
void
|
||||
draw_preview_inbe(Inbe *inbe, int center_x, int center_y)
|
||||
{
|
||||
int r = (int)((float)inbe->r * 0.72f);
|
||||
DrawCircle(center_x, center_y, r, c_circle);
|
||||
DrawCircleLines(center_x, center_y, r, c_text);
|
||||
}
|
||||
|
||||
static Texture2D
|
||||
sound_icon_for_volume(InbeApp *app)
|
||||
{
|
||||
int vol = app->sound_volume;
|
||||
if(vol <= 0) return app->sound0_icon;
|
||||
if(vol <= 25) return app->sound1_icon;
|
||||
if(vol <= 75) return app->sound2_icon;
|
||||
return app->sound3_icon;
|
||||
}
|
||||
|
||||
static void
|
||||
stop_android_background_session(InbeApp *app)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
if(app->inbe.play_in_background) {
|
||||
android_wakelock_release();
|
||||
android_timer_stop();
|
||||
}
|
||||
#else
|
||||
(void)app;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
session_update_screen(InbeApp *app, int center_x, int center_y, int *hover)
|
||||
{
|
||||
int return_hover = 0;
|
||||
int modal_result = 0;
|
||||
int breath_max_y = view_height - flint_px(44);
|
||||
|
||||
if(ui_draw_icon_btn_padded(flint_px(12), flint_px(12), flint_px(24),
|
||||
flint_px(10), app->return_icon, UI_ICON_TYPE_RETURN, &return_hover)) {
|
||||
if(app->session_paused) {
|
||||
stop_android_background_session(app);
|
||||
inbe_app_init(app);
|
||||
} else {
|
||||
app->modal.active = 1;
|
||||
app->modal.type = UIModalConfirmExitSession;
|
||||
app->modal.selected_button = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int sound_btn_x = view_width - flint_px(56);
|
||||
int sound_btn_y = flint_px(12);
|
||||
int sound_btn_size = flint_px(24);
|
||||
int sound_btn_padding = flint_px(10);
|
||||
int sound_hover = 0;
|
||||
if(ui_draw_icon_btn_padded(sound_btn_x, sound_btn_y, sound_btn_size, sound_btn_padding,
|
||||
sound_icon_for_volume(app), UI_ICON_TYPE_SOUND, &sound_hover)) {
|
||||
app->volume_popup_active = !app->volume_popup_active;
|
||||
}
|
||||
|
||||
if(app->volume_popup_active) {
|
||||
int popup_w = flint_px(44);
|
||||
int popup_x = sound_btn_x;
|
||||
int popup_y = sound_btn_y + sound_btn_size + sound_btn_padding * 2;
|
||||
int popup_h = flint_px(200);
|
||||
Vector2 mouse = GetMousePosition();
|
||||
|
||||
if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT) &&
|
||||
(mouse.x < popup_x || mouse.x > popup_x + popup_w ||
|
||||
mouse.y < popup_y || mouse.y > popup_y + popup_h)) {
|
||||
app->volume_popup_active = 0;
|
||||
}
|
||||
|
||||
DrawRectangle(popup_x, popup_y, popup_w, popup_h, c_button);
|
||||
ui_draw_bevel(popup_x, popup_y, popup_w, popup_h,
|
||||
flint_lighten(c_button, 40), flint_darken(c_button, 40));
|
||||
|
||||
if(ui_draw_slider_vertical(500, popup_x + popup_w / 2, popup_y + flint_px(10),
|
||||
popup_h - flint_px(20), SETTINGS_VOLUME_MIN,
|
||||
SETTINGS_VOLUME_MAX, &app->sound_volume)) {
|
||||
app->settings_dirty = 1;
|
||||
update_session_sounds(app);
|
||||
save_settings(app);
|
||||
}
|
||||
}
|
||||
|
||||
if(app->modal.active && app->modal.type == UIModalConfirmExitSession) {
|
||||
if(session_has_completed_rounds(app)) {
|
||||
modal_result = ui_draw_modal_3btn(locale_get("exit_session_title"),
|
||||
locale_get("save_completed_rounds_message"),
|
||||
locale_get("cancel_button"),
|
||||
locale_get("save_button"),
|
||||
locale_get("discard_button"));
|
||||
if(modal_result == 1) {
|
||||
app->modal.active = 0;
|
||||
app->modal.type = UIModalNone;
|
||||
} else if(modal_result == 2) {
|
||||
session_ensure_results_saved(app);
|
||||
stop_android_background_session(app);
|
||||
app->modal.active = 0;
|
||||
app->modal.type = UIModalNone;
|
||||
inbe_app_init(app);
|
||||
} else if(modal_result == 3) {
|
||||
stop_android_background_session(app);
|
||||
app->modal.active = 0;
|
||||
app->modal.type = UIModalNone;
|
||||
inbe_app_init(app);
|
||||
}
|
||||
} else {
|
||||
modal_result = ui_draw_modal(locale_get("exit_session_title"),
|
||||
locale_get("all_progress_lost_message"),
|
||||
locale_get("cancel_button"),
|
||||
locale_get("exit_button"));
|
||||
if(modal_result == 1) {
|
||||
app->modal.active = 0;
|
||||
app->modal.type = UIModalNone;
|
||||
} else if(modal_result == 2) {
|
||||
stop_android_background_session(app);
|
||||
app->modal.active = 0;
|
||||
app->modal.type = UIModalNone;
|
||||
inbe_app_init(app);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(app->advanced_session_controls) {
|
||||
int back_hover = 0;
|
||||
int pause_hover = 0;
|
||||
int forward_hover = 0;
|
||||
int control_size = flint_px(24);
|
||||
int control_padding = flint_px(10);
|
||||
int control_gap = flint_px(12);
|
||||
int min_view_dim = view_width < view_height ? view_width : view_height;
|
||||
int available_row_w = view_width - flint_px(48);
|
||||
int max_btn_w = min_view_dim / 6;
|
||||
int max_btn_w_by_row;
|
||||
int control_btn_w;
|
||||
int control_y;
|
||||
int pause_x;
|
||||
int back_x;
|
||||
int forward_x;
|
||||
|
||||
if(available_row_w < flint_px(120))
|
||||
available_row_w = flint_px(120);
|
||||
|
||||
max_btn_w_by_row = (available_row_w - control_gap * 2) / 3;
|
||||
if(max_btn_w <= 0 || max_btn_w > max_btn_w_by_row)
|
||||
max_btn_w = max_btn_w_by_row;
|
||||
|
||||
control_btn_w = control_size + control_padding * 2;
|
||||
if(control_btn_w > max_btn_w) {
|
||||
control_btn_w = max_btn_w;
|
||||
control_padding = control_btn_w / 4;
|
||||
control_size = control_btn_w - control_padding * 2;
|
||||
}
|
||||
|
||||
if(control_padding < flint_px(6))
|
||||
control_padding = flint_px(6);
|
||||
if(control_size < flint_px(16))
|
||||
control_size = flint_px(16);
|
||||
|
||||
control_btn_w = control_size + control_padding * 2;
|
||||
control_gap = control_btn_w / 4;
|
||||
if(control_gap < flint_px(8))
|
||||
control_gap = flint_px(8);
|
||||
control_y = view_height - flint_px(6) - control_btn_w;
|
||||
breath_max_y = control_y - flint_px(44);
|
||||
pause_x = center_x - control_btn_w / 2;
|
||||
back_x = pause_x - control_btn_w - control_gap;
|
||||
forward_x = pause_x + control_btn_w + control_gap;
|
||||
|
||||
if(ui_draw_icon_btn_padded(back_x, control_y, control_size, control_padding,
|
||||
app->backward_icon, UI_ICON_TYPE_BACKWARD, &back_hover))
|
||||
session_step_back(app);
|
||||
if(ui_draw_icon_btn_padded(pause_x, control_y, control_size, control_padding,
|
||||
app->session_paused ? app->play_icon : app->pause_icon,
|
||||
app->session_paused ? UI_ICON_TYPE_PLAY : UI_ICON_TYPE_PAUSE,
|
||||
&pause_hover))
|
||||
app->session_paused = !app->session_paused;
|
||||
if(ui_draw_icon_btn_padded(forward_x, control_y, control_size, control_padding,
|
||||
app->forward_icon, UI_ICON_TYPE_FORWARD, &forward_hover))
|
||||
session_step_forward(app);
|
||||
}
|
||||
|
||||
draw_session_status(app, center_x, center_y);
|
||||
|
||||
if(!app->session_paused) {
|
||||
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
pthread_mutex_t *timer_mutex = android_timer_get_mutex();
|
||||
if(timer_mutex) {
|
||||
pthread_mutex_lock(timer_mutex);
|
||||
inbestep(&app->inbe);
|
||||
update_session_sounds(app);
|
||||
pthread_mutex_unlock(timer_mutex);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
inbestep(&app->inbe);
|
||||
update_session_sounds(app);
|
||||
}
|
||||
}
|
||||
|
||||
if(app->inbe.phase == InbePhaseHold) {
|
||||
int breath_y = center_y + (int)(app->inbe.rmax * flint_dpi_scale() + 0.5f) + flint_px(24);
|
||||
if(breath_y > breath_max_y)
|
||||
breath_y = breath_max_y;
|
||||
if(ui_draw_text_btn(center_x, breath_y, locale_get("breath_button"), hover))
|
||||
finish_hold(app);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
session_draw_results_screen(InbeApp *app, int center_x, int center_y, int *hover)
|
||||
{
|
||||
int box_x;
|
||||
int box_y = flint_px(78);
|
||||
int box_w;
|
||||
int row_y = flint_px(215);
|
||||
int row_h = flint_px(32);
|
||||
int total = 0;
|
||||
int best = -1;
|
||||
int round_times[MaxRounds];
|
||||
int rounds = collect_result_rounds(app, round_times, MaxRounds);
|
||||
int discard_hover = 0;
|
||||
int save_hover = 0;
|
||||
int action_y = view_height - flint_px(40);
|
||||
int title_font = flint_px(32);
|
||||
int title_w;
|
||||
|
||||
(void)center_y;
|
||||
|
||||
if(rounds <= 0) {
|
||||
inbe_app_init(app);
|
||||
return;
|
||||
}
|
||||
|
||||
int responsive_max_w = (int)(view_width * 0.96f);
|
||||
int min_content_w = flint_px(320);
|
||||
if(responsive_max_w < min_content_w)
|
||||
responsive_max_w = min_content_w;
|
||||
flint_centered_column(responsive_max_w, flint_page_side_padding(), &box_x, &box_w);
|
||||
|
||||
title_w = flint_text_measure(locale_get("results_title"), title_font);
|
||||
flint_text_draw(locale_get("results_title"), center_x - title_w / 2, flint_px(34), title_font, c_text);
|
||||
|
||||
for(int i = 0; i < rounds; i++) {
|
||||
int seconds = round_times[i];
|
||||
total += seconds;
|
||||
if(best < 0 || seconds > best)
|
||||
best = seconds;
|
||||
}
|
||||
if(best < 0)
|
||||
best = 0;
|
||||
|
||||
DrawRectangle(box_x, box_y, box_w, flint_px(88), flint_darken(c_bg, 6));
|
||||
DrawLine(box_x, box_y + flint_px(29), box_x + box_w, box_y + flint_px(29), flint_darken(c_bg, 30));
|
||||
DrawLine(box_x, box_y + flint_px(58), box_x + box_w, box_y + flint_px(58), flint_darken(c_bg, 30));
|
||||
{
|
||||
char line[64];
|
||||
locale_format(line, sizeof(line), "results_rounds", rounds);
|
||||
flint_text_draw(line, box_x + flint_px(10), box_y + flint_px(10), flint_px(16), c_text);
|
||||
locale_format(line, sizeof(line), "results_best", best);
|
||||
flint_text_draw(line, box_x + flint_px(10), box_y + flint_px(39), flint_px(16), c_text);
|
||||
locale_format(line, sizeof(line), "results_avg", rounds > 0 ? total / rounds : 0);
|
||||
if(view_width < 420 && flint_text_measure(line, flint_px(16)) > box_w - flint_px(20))
|
||||
snprintf(line, sizeof(line), "%ds", rounds > 0 ? total / rounds : 0);
|
||||
flint_text_draw(line, box_x + flint_px(10), box_y + flint_px(68), flint_px(16), c_text);
|
||||
}
|
||||
|
||||
flint_text_draw(locale_get("round_times_title"), box_x, flint_px(188),
|
||||
flint_ui_font(), flint_darken(c_text, 20));
|
||||
for(int i = 0; i < rounds; i++) {
|
||||
char row[48];
|
||||
int row_font = flint_ui_font();
|
||||
locale_format(row, sizeof(row), "round_result_label", i + 1, round_times[i]);
|
||||
DrawRectangle(box_x, row_y - 1, box_w, row_h, flint_darken(c_bg, 4));
|
||||
DrawLine(box_x, row_y + row_h - 2, box_x + box_w, row_y + row_h - 2, flint_darken(c_bg, 26));
|
||||
flint_text_draw(row, box_x + flint_px(10), flint_ui_text_y(row, row_y, row_h, row_font), row_font, c_text);
|
||||
row_y += row_h;
|
||||
}
|
||||
|
||||
if(ui_draw_text_btn(center_x - box_w / 4, action_y, locale_get("discard_button"), &discard_hover)) {
|
||||
session_discard_saved_results(app);
|
||||
inbe_app_init(app);
|
||||
}
|
||||
if(ui_draw_text_btn(center_x + box_w / 4, action_y, locale_get("save_results_button"), &save_hover)) {
|
||||
if(session_ensure_results_saved(app))
|
||||
inbe_app_init(app);
|
||||
}
|
||||
if(discard_hover || save_hover)
|
||||
*hover = 1;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef INBE_APP_SESSION_H
|
||||
#define INBE_APP_SESSION_H
|
||||
|
||||
#include "app.h"
|
||||
|
||||
void session_reset_round_breathe(Inbe *inbe);
|
||||
void session_update_circle_bounds_for_view(Inbe *inbe, int top_reserve, int bottom_reserve);
|
||||
void session_start(InbeApp *app);
|
||||
int session_ensure_results_saved(InbeApp *app);
|
||||
void session_discard_saved_results(InbeApp *app);
|
||||
int session_has_completed_rounds(InbeApp *app);
|
||||
void session_draw_inbe(InbeApp *app, int center_x, int center_y);
|
||||
void session_update_screen(InbeApp *app, int center_x, int center_y, int *hover);
|
||||
void session_draw_results_screen(InbeApp *app, int center_x, int center_y, int *hover);
|
||||
void update_session_sounds(InbeApp *app);
|
||||
void update_preview_bounds(Inbe *inbe, int content_w, int max_h);
|
||||
void draw_preview_inbe(Inbe *inbe, int center_x, int center_y);
|
||||
int draw_hold_display_mode_selector(InbeApp *app, int x, int y, int w);
|
||||
|
||||
#endif
|
||||
@@ -762,12 +762,313 @@ data_export(const char *path)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
validate_metadata(const char *metadata, int *session_count)
|
||||
{
|
||||
char *dup;
|
||||
char *line;
|
||||
int line_count = 0;
|
||||
|
||||
if(metadata == NULL || session_count == NULL)
|
||||
return 0;
|
||||
|
||||
dup = strdup(metadata);
|
||||
if(dup == NULL)
|
||||
return 0;
|
||||
|
||||
line = strtok(dup, "\n");
|
||||
while(line != NULL && line_count < 4) {
|
||||
// Trim whitespace
|
||||
while(*line == ' ' || *line == '\t' || *line == '\r')
|
||||
line++;
|
||||
|
||||
line_count++;
|
||||
if(line_count == 4) {
|
||||
// Fourth line contains the session count, possibly in a localized label.
|
||||
while(*line != '\0' && (*line < '0' || *line > '9'))
|
||||
line++;
|
||||
*session_count = atoi(line);
|
||||
free(dup);
|
||||
return (*session_count >= 0);
|
||||
}
|
||||
line = strtok(NULL, "\n");
|
||||
}
|
||||
|
||||
free(dup);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_session_path(const char *zip_path, int *year, int *month, int *day, char *filename)
|
||||
{
|
||||
int y, m, d;
|
||||
const char *p;
|
||||
const char *prefix = "lotus-data/sessions/";
|
||||
size_t prefix_len = strlen(prefix);
|
||||
|
||||
if(zip_path == NULL || year == NULL || month == NULL || day == NULL || filename == NULL)
|
||||
return 0;
|
||||
|
||||
// Expected format: lotus-data/sessions/YYYY/MM/DD/inbe-HHMMSS
|
||||
if(strncmp(zip_path, prefix, prefix_len) != 0)
|
||||
return 0;
|
||||
|
||||
p = zip_path + prefix_len;
|
||||
|
||||
// Parse year
|
||||
if(sscanf(p, "%04d", &y) != 1 || y < 1970 || y > 2100 || p[4] != '/')
|
||||
return 0;
|
||||
p += 5;
|
||||
|
||||
// Parse month
|
||||
if(sscanf(p, "%02d", &m) != 1 || m < 1 || m > 12 || p[2] != '/')
|
||||
return 0;
|
||||
p += 3;
|
||||
|
||||
// Parse day
|
||||
if(sscanf(p, "%02d", &d) != 1 || d < 1 || d > 31 || p[2] != '/')
|
||||
return 0;
|
||||
p += 3;
|
||||
|
||||
// Expect filename starting with "inbe-"
|
||||
if(strncmp(p, "inbe-", 5) != 0)
|
||||
return 0;
|
||||
|
||||
// Copy filename
|
||||
if(strlen(p) >= FS_PATH_MAX - 1)
|
||||
return 0;
|
||||
|
||||
strcpy(filename, p);
|
||||
|
||||
*year = y;
|
||||
*month = m;
|
||||
*day = d;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
validate_session_content(const char *content, int *round_count)
|
||||
{
|
||||
char *dup;
|
||||
char *line;
|
||||
int count = 0;
|
||||
int valid = 1;
|
||||
|
||||
if(content == NULL || round_count == NULL)
|
||||
return 0;
|
||||
|
||||
dup = strdup(content);
|
||||
if(dup == NULL)
|
||||
return 0;
|
||||
|
||||
line = strtok(dup, "\n");
|
||||
while(line != NULL) {
|
||||
// Trim whitespace
|
||||
while(*line == ' ' || *line == '\t' || *line == '\r')
|
||||
line++;
|
||||
|
||||
if(*line != '\0') {
|
||||
int seconds = atoi(line);
|
||||
if(seconds > 0 && seconds <= 999) {
|
||||
count++;
|
||||
} else {
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
line = strtok(NULL, "\n");
|
||||
}
|
||||
|
||||
free(dup);
|
||||
|
||||
if(valid && count > 0) {
|
||||
*round_count = count;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
import_session_file(const char *zip_path, const char *local_path, mz_zip_archive *archive)
|
||||
{
|
||||
char *content = NULL;
|
||||
size_t size;
|
||||
FILE *fp;
|
||||
int round_count;
|
||||
|
||||
if(zip_path == NULL || local_path == NULL || archive == NULL)
|
||||
return 0;
|
||||
|
||||
// Extract file from ZIP
|
||||
size = 0;
|
||||
content = (char *)mz_zip_reader_extract_file_to_heap(archive, zip_path, &size, 0);
|
||||
if(content == NULL || size == 0) {
|
||||
TraceLog(LOG_WARNING, "DATA: failed to extract file from ZIP: %s", zip_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Validate session content
|
||||
if(!validate_session_content(content, &round_count)) {
|
||||
TraceLog(LOG_WARNING, "DATA: invalid session content: %s", zip_path);
|
||||
free(content);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create directory structure if needed
|
||||
char dir_path[FS_PATH_MAX];
|
||||
strncpy(dir_path, local_path, sizeof(dir_path) - 1);
|
||||
dir_path[sizeof(dir_path) - 1] = '\0';
|
||||
|
||||
char *last_slash = strrchr(dir_path, '/');
|
||||
if(last_slash != NULL) {
|
||||
*last_slash = '\0';
|
||||
if(!ensure_dir(dir_path)) {
|
||||
TraceLog(LOG_ERROR, "DATA: failed to create directory: %s", dir_path);
|
||||
free(content);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Write session file
|
||||
fp = fopen(local_path, "w");
|
||||
if(fp == NULL) {
|
||||
TraceLog(LOG_ERROR, "DATA: failed to open file for writing: %s", local_path);
|
||||
free(content);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(fwrite(content, 1, size, fp) != size) {
|
||||
TraceLog(LOG_ERROR, "DATA: failed to write session file: %s", local_path);
|
||||
fclose(fp);
|
||||
free(content);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
free(content);
|
||||
|
||||
TraceLog(LOG_INFO, "DATA: imported session: %s (%d rounds)", local_path, round_count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Validate import file before attempting to read ZIP
|
||||
int data_validate_import_file(const char *path) {
|
||||
if(!path || path[0] == '\0')
|
||||
return 0;
|
||||
|
||||
if(!FileExists(path))
|
||||
return 0;
|
||||
|
||||
// Check if file is readable
|
||||
FILE *test = fopen(path, "rb");
|
||||
if(!test)
|
||||
return 0;
|
||||
|
||||
fclose(test);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
data_import(const char *path)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "DATA: import not yet implemented");
|
||||
(void)path;
|
||||
return 0;
|
||||
mz_zip_archive archive;
|
||||
char *metadata = NULL;
|
||||
size_t metadata_size;
|
||||
int session_count = 0;
|
||||
int imported_count = 0;
|
||||
int failed_count = 0;
|
||||
int total_files;
|
||||
|
||||
if(path == NULL || path[0] == '\0') {
|
||||
TraceLog(LOG_ERROR, "DATA: import path is empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Validate import file before attempting to read ZIP
|
||||
if(!data_validate_import_file(path)) {
|
||||
TraceLog(LOG_ERROR, "DATA: import file validation failed: %s", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Initialize ZIP reader
|
||||
memset(&archive, 0, sizeof(archive));
|
||||
if(!mz_zip_reader_init_file(&archive, path, 0)) {
|
||||
TraceLog(LOG_ERROR, "DATA: failed to open ZIP file: %s", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Extract and validate metadata
|
||||
metadata_size = 0;
|
||||
metadata = (char *)mz_zip_reader_extract_file_to_heap(&archive, "lotus-data/metadata.txt", &metadata_size, 0);
|
||||
if(metadata == NULL || metadata_size == 0) {
|
||||
TraceLog(LOG_ERROR, "DATA: failed to extract metadata from ZIP");
|
||||
mz_zip_reader_end(&archive);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!validate_metadata(metadata, &session_count)) {
|
||||
TraceLog(LOG_ERROR, "DATA: invalid metadata format");
|
||||
free(metadata);
|
||||
mz_zip_reader_end(&archive);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(metadata);
|
||||
TraceLog(LOG_INFO, "DATA: metadata validated, expecting %d sessions", session_count);
|
||||
|
||||
// Process session files
|
||||
total_files = (int)mz_zip_reader_get_num_files(&archive);
|
||||
|
||||
for(int i = 0; i < total_files; i++) {
|
||||
mz_zip_archive_file_stat file_stat;
|
||||
char zip_path[FS_PATH_MAX];
|
||||
char local_path[FS_PATH_MAX];
|
||||
int year, month, day;
|
||||
char filename[FS_PATH_MAX];
|
||||
|
||||
if(!mz_zip_reader_file_stat(&archive, i, &file_stat))
|
||||
continue;
|
||||
|
||||
if(file_stat.m_is_directory)
|
||||
continue;
|
||||
|
||||
strncpy(zip_path, file_stat.m_filename, sizeof(zip_path) - 1);
|
||||
zip_path[sizeof(zip_path) - 1] = '\0';
|
||||
|
||||
// Check if this is a session file
|
||||
if(strncmp(zip_path, "lotus-data/sessions/", strlen("lotus-data/sessions/")) != 0)
|
||||
continue;
|
||||
|
||||
if(!parse_session_path(zip_path, &year, &month, &day, filename)) {
|
||||
TraceLog(LOG_WARNING, "DATA: invalid session path: %s", zip_path);
|
||||
failed_count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Construct local path
|
||||
snprintf(local_path, sizeof(local_path), "%s/%04d/%02d/%02d/%s",
|
||||
data_root(), year, month, day, filename);
|
||||
|
||||
// Import session file
|
||||
if(import_session_file(zip_path, local_path, &archive)) {
|
||||
imported_count++;
|
||||
} else {
|
||||
failed_count++;
|
||||
}
|
||||
}
|
||||
|
||||
mz_zip_reader_end(&archive);
|
||||
|
||||
if(imported_count > 0) {
|
||||
TraceLog(LOG_INFO, "DATA: import completed: %d imported, %d failed", imported_count, failed_count);
|
||||
return 1;
|
||||
} else {
|
||||
TraceLog(LOG_WARNING, "DATA: no sessions imported");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -18,6 +18,7 @@ int data_get_session_count(void);
|
||||
long long data_delete_all(void);
|
||||
int data_export(const char *path);
|
||||
int data_import(const char *path);
|
||||
int data_validate_import_file(const char *path);
|
||||
typedef void (*data_session_callback)(const char *date, const char *time,
|
||||
int rounds, int best, void *user);
|
||||
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
#include "file_dialog.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Windows headers must be included first, before any raylib includes */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
/* Simple DirectoryExists implementation to avoid pulling in raylib.h */
|
||||
/* Only used on Linux */
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
static int DirectoryExists(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
return (stat(path, &st) == 0 && S_ISDIR(st.st_mode));
|
||||
}
|
||||
#endif
|
||||
|
||||
void file_dialog_init(FileDialog *dlg)
|
||||
{
|
||||
if(dlg == NULL)
|
||||
return;
|
||||
dlg->active = 0;
|
||||
dlg->mode = 0;
|
||||
dlg->path[0] = '\0';
|
||||
dlg->filename[0] = '\0';
|
||||
dlg->cursor = 0;
|
||||
}
|
||||
|
||||
static void copy_text_bounded(char *dst, size_t dst_size, const char *src)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
if(dst == NULL || dst_size == 0)
|
||||
return;
|
||||
if(src == NULL)
|
||||
src = "";
|
||||
|
||||
while(len + 1 < dst_size && src[len] != '\0')
|
||||
len++;
|
||||
memcpy(dst, src, len);
|
||||
dst[len] = '\0';
|
||||
}
|
||||
|
||||
static void join_path_bounded(char *dst, size_t dst_size, const char *base, const char *name, char sep)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
if(dst == NULL || dst_size == 0)
|
||||
return;
|
||||
|
||||
dst[0] = '\0';
|
||||
if(base == NULL || base[0] == '\0') {
|
||||
copy_text_bounded(dst, dst_size, name);
|
||||
return;
|
||||
}
|
||||
|
||||
while(len + 1 < dst_size && base[len] != '\0') {
|
||||
dst[len] = base[len];
|
||||
len++;
|
||||
}
|
||||
if(len + 1 < dst_size && len > 0 && dst[len - 1] != '/' && dst[len - 1] != '\\')
|
||||
dst[len++] = sep;
|
||||
for(size_t i = 0; len + 1 < dst_size && name != NULL && name[i] != '\0'; i++)
|
||||
dst[len++] = name[i];
|
||||
dst[len] = '\0';
|
||||
}
|
||||
|
||||
static void get_default_export_path(char *path, size_t size, const char *filename)
|
||||
{
|
||||
(void)filename; /* Will use in the Windows path */
|
||||
|
||||
#if defined(_WIN32)
|
||||
char home[MAX_PATH];
|
||||
/* CSIDL_DOWNLOADS = 0x0006 */
|
||||
if(SHGetFolderPathA(NULL, 0x0006, NULL, 0, home) == S_OK) {
|
||||
join_path_bounded(path, size, home, filename, '\\');
|
||||
} else {
|
||||
copy_text_bounded(path, size, filename);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
const char *base = getenv("HOME");
|
||||
if(base != NULL) {
|
||||
char downloads[512];
|
||||
join_path_bounded(downloads, sizeof(downloads), base, "Downloads", '/');
|
||||
join_path_bounded(path, size, downloads, filename, '/');
|
||||
} else {
|
||||
copy_text_bounded(path, size, filename);
|
||||
}
|
||||
#else
|
||||
/* Linux and other Unix-like systems */
|
||||
const char *base = getenv("HOME");
|
||||
if(base != NULL) {
|
||||
/* Try Downloads first, fall back to home */
|
||||
char downloads[512];
|
||||
join_path_bounded(downloads, sizeof(downloads), base, "Downloads", '/');
|
||||
if(DirectoryExists(downloads)) {
|
||||
join_path_bounded(path, size, downloads, filename, '/');
|
||||
} else {
|
||||
join_path_bounded(path, size, base, filename, '/');
|
||||
}
|
||||
} else {
|
||||
/* Fallback to current directory */
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
if(pw != NULL && pw->pw_dir != NULL) {
|
||||
join_path_bounded(path, size, pw->pw_dir, filename, '/');
|
||||
} else {
|
||||
copy_text_bounded(path, size, filename);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int file_dialog_save(FileDialog *dlg, const char *title, const char *default_filename)
|
||||
{
|
||||
char full_path[512];
|
||||
time_t now;
|
||||
struct tm *tm;
|
||||
char date_str[32];
|
||||
char generated_filename[128];
|
||||
|
||||
(void)title; /* Not used in simple implementation */
|
||||
(void)default_filename; /* Will generate our own */
|
||||
|
||||
if(dlg == NULL)
|
||||
return 0;
|
||||
|
||||
/* Generate filename with timestamp */
|
||||
now = time(NULL);
|
||||
tm = localtime(&now);
|
||||
if(tm != NULL) {
|
||||
snprintf(date_str, sizeof(date_str), "%04d-%02d-%02d",
|
||||
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
||||
snprintf(generated_filename, sizeof(generated_filename),
|
||||
"inbe-export-%s.zip", date_str);
|
||||
} else {
|
||||
strcpy(generated_filename, "inbe-export.zip");
|
||||
}
|
||||
|
||||
/* Get default export path */
|
||||
get_default_export_path(full_path, sizeof(full_path), generated_filename);
|
||||
|
||||
/* Store the path */
|
||||
strncpy(dlg->path, full_path, sizeof(dlg->path) - 1);
|
||||
dlg->path[sizeof(dlg->path) - 1] = '\0';
|
||||
|
||||
/* Extract filename for display */
|
||||
const char *slash = strrchr(full_path, '/');
|
||||
if(slash == NULL)
|
||||
slash = strrchr(full_path, '\\');
|
||||
if(slash != NULL) {
|
||||
strncpy(dlg->filename, slash + 1, sizeof(dlg->filename) - 1);
|
||||
} else {
|
||||
strncpy(dlg->filename, generated_filename, sizeof(dlg->filename) - 1);
|
||||
}
|
||||
dlg->filename[sizeof(dlg->filename) - 1] = '\0';
|
||||
|
||||
/* Auto-confirm for simple implementation */
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *file_dialog_get_path(FileDialog *dlg)
|
||||
{
|
||||
if(dlg == NULL)
|
||||
return NULL;
|
||||
return dlg->path;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef FILE_DIALOG_H
|
||||
#define FILE_DIALOG_H
|
||||
|
||||
/* File dialog state */
|
||||
typedef struct {
|
||||
int active;
|
||||
int mode; /* 0 = save, 1 = load */
|
||||
char path[512];
|
||||
char filename[128];
|
||||
int cursor;
|
||||
} FileDialog;
|
||||
|
||||
/* Initialize file dialog */
|
||||
void file_dialog_init(FileDialog *dlg);
|
||||
|
||||
/* Show save file dialog
|
||||
* dlg: Dialog state
|
||||
* title: Dialog title
|
||||
* default_filename: Suggested filename
|
||||
* Returns: 1 if user confirmed, 0 if cancelled */
|
||||
int file_dialog_save(FileDialog *dlg, const char *title, const char *default_filename);
|
||||
|
||||
/* Get the selected path
|
||||
* dlg: Dialog state
|
||||
* Returns: Full path to selected file */
|
||||
const char *file_dialog_get_path(FileDialog *dlg);
|
||||
|
||||
#endif
|
||||
@@ -1,680 +1,6 @@
|
||||
#include "locale.h"
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct LocaleEntry {
|
||||
char *key;
|
||||
char *value;
|
||||
} LocaleEntry;
|
||||
|
||||
typedef struct LocaleLanguage {
|
||||
char *code;
|
||||
char *label;
|
||||
} LocaleLanguage;
|
||||
|
||||
static LocaleEntry *g_base_entries = NULL;
|
||||
static size_t g_base_count = 0;
|
||||
static size_t g_base_cap = 0;
|
||||
|
||||
static LocaleEntry *g_active_entries = NULL;
|
||||
static size_t g_active_count = 0;
|
||||
static size_t g_active_cap = 0;
|
||||
|
||||
static LocaleLanguage *g_languages = NULL;
|
||||
static size_t g_language_count = 0;
|
||||
static size_t g_language_cap = 0;
|
||||
|
||||
static int g_loaded = 0;
|
||||
static char g_current_code[32] = "en";
|
||||
|
||||
static char *
|
||||
dup_range(const char *src, size_t len)
|
||||
{
|
||||
char *out = malloc(len + 1);
|
||||
if(out == NULL)
|
||||
return NULL;
|
||||
memcpy(out, src, len);
|
||||
out[len] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
static char *
|
||||
dup_cstr(const char *src)
|
||||
{
|
||||
return dup_range(src, strlen(src));
|
||||
}
|
||||
|
||||
static void
|
||||
free_locale_entries(LocaleEntry **entries, size_t *count, size_t *cap)
|
||||
{
|
||||
if(entries == NULL || *entries == NULL)
|
||||
return;
|
||||
|
||||
for(size_t i = 0; i < *count; i++) {
|
||||
free((*entries)[i].key);
|
||||
free((*entries)[i].value);
|
||||
}
|
||||
free(*entries);
|
||||
*entries = NULL;
|
||||
*count = 0;
|
||||
*cap = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
free_languages(void)
|
||||
{
|
||||
if(g_languages == NULL)
|
||||
return;
|
||||
|
||||
for(size_t i = 0; i < g_language_count; i++) {
|
||||
free(g_languages[i].code);
|
||||
free(g_languages[i].label);
|
||||
}
|
||||
free(g_languages);
|
||||
g_languages = NULL;
|
||||
g_language_count = 0;
|
||||
g_language_cap = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_locale_capacity(LocaleEntry **entries, size_t *cap, size_t count)
|
||||
{
|
||||
LocaleEntry *next;
|
||||
size_t next_cap;
|
||||
|
||||
if(count < *cap)
|
||||
return;
|
||||
|
||||
next_cap = (*cap == 0) ? 32 : *cap * 2;
|
||||
next = realloc(*entries, next_cap * sizeof(*next));
|
||||
if(next == NULL)
|
||||
return;
|
||||
|
||||
*entries = next;
|
||||
*cap = next_cap;
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_language_capacity(void)
|
||||
{
|
||||
LocaleLanguage *next;
|
||||
size_t next_cap;
|
||||
|
||||
if(g_language_count < g_language_cap)
|
||||
return;
|
||||
|
||||
next_cap = (g_language_cap == 0) ? 8 : g_language_cap * 2;
|
||||
next = realloc(g_languages, next_cap * sizeof(*next));
|
||||
if(next == NULL)
|
||||
return;
|
||||
|
||||
g_languages = next;
|
||||
g_language_cap = next_cap;
|
||||
}
|
||||
|
||||
static void
|
||||
set_locale_entry(LocaleEntry **entries, size_t *count, size_t *cap, const char *key, const char *value)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if(entries == NULL || count == NULL || cap == NULL || key == NULL || value == NULL)
|
||||
return;
|
||||
|
||||
for(i = 0; i < *count; i++) {
|
||||
if(strcmp((*entries)[i].key, key) == 0) {
|
||||
char *new_value = dup_cstr(value);
|
||||
if(new_value == NULL)
|
||||
return;
|
||||
free((*entries)[i].value);
|
||||
(*entries)[i].value = new_value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ensure_locale_capacity(entries, cap, *count);
|
||||
if(*count >= *cap)
|
||||
return;
|
||||
|
||||
(*entries)[*count].key = dup_cstr(key);
|
||||
(*entries)[*count].value = dup_cstr(value);
|
||||
if((*entries)[*count].key == NULL || (*entries)[*count].value == NULL) {
|
||||
free((*entries)[*count].key);
|
||||
free((*entries)[*count].value);
|
||||
(*entries)[*count].key = NULL;
|
||||
(*entries)[*count].value = NULL;
|
||||
return;
|
||||
}
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static const char *
|
||||
find_locale_entry(LocaleEntry *entries, size_t count, const char *key)
|
||||
{
|
||||
if(key == NULL)
|
||||
return "";
|
||||
|
||||
for(size_t i = 0; i < count; i++) {
|
||||
if(strcmp(entries[i].key, key) == 0)
|
||||
return entries[i].value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
append_text(char **buf, size_t *len, size_t *cap, const char *text)
|
||||
{
|
||||
size_t text_len;
|
||||
char *next;
|
||||
size_t needed;
|
||||
|
||||
if(text == NULL)
|
||||
return;
|
||||
|
||||
text_len = strlen(text);
|
||||
needed = *len + text_len + 1;
|
||||
if(*cap < needed) {
|
||||
size_t next_cap = (*cap == 0) ? 128 : *cap;
|
||||
while(next_cap < needed)
|
||||
next_cap *= 2;
|
||||
next = realloc(*buf, next_cap);
|
||||
if(next == NULL)
|
||||
return;
|
||||
*buf = next;
|
||||
*cap = next_cap;
|
||||
}
|
||||
|
||||
memcpy(*buf + *len, text, text_len);
|
||||
*len += text_len;
|
||||
(*buf)[*len] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
append_char(char **buf, size_t *len, size_t *cap, char c)
|
||||
{
|
||||
char tmp[2] = { c, '\0' };
|
||||
append_text(buf, len, cap, tmp);
|
||||
}
|
||||
|
||||
static void
|
||||
load_locale_text_into(LocaleEntry **entries, size_t *count, size_t *cap, const char *text)
|
||||
{
|
||||
char *mutable_text;
|
||||
char *cursor;
|
||||
char *current_key = NULL;
|
||||
char *body = NULL;
|
||||
size_t body_len = 0;
|
||||
size_t body_cap = 0;
|
||||
|
||||
if(text == NULL || entries == NULL || count == NULL || cap == NULL)
|
||||
return;
|
||||
|
||||
mutable_text = dup_cstr(text);
|
||||
if(mutable_text == NULL)
|
||||
return;
|
||||
|
||||
cursor = mutable_text;
|
||||
while(cursor != NULL && *cursor != '\0') {
|
||||
char *line = cursor;
|
||||
char *eol = strpbrk(cursor, "\r\n");
|
||||
if(eol != NULL) {
|
||||
char line_end = *eol;
|
||||
*eol = '\0';
|
||||
cursor = eol + 1;
|
||||
if((line_end == '\r' && *cursor == '\n') || (line_end == '\n' && *cursor == '\r'))
|
||||
cursor++;
|
||||
} else {
|
||||
cursor = NULL;
|
||||
}
|
||||
|
||||
if(line[0] == '[') {
|
||||
size_t line_len = strlen(line);
|
||||
if(line_len > 2 && line[line_len - 1] == ']') {
|
||||
char *key = dup_range(line + 1, line_len - 2);
|
||||
if(key != NULL) {
|
||||
free(current_key);
|
||||
current_key = key;
|
||||
free(body);
|
||||
body = NULL;
|
||||
body_len = 0;
|
||||
body_cap = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(strcmp(line, "---") == 0) {
|
||||
if(current_key != NULL) {
|
||||
set_locale_entry(entries, count, cap, current_key, body != NULL ? body : "");
|
||||
free(current_key);
|
||||
current_key = NULL;
|
||||
}
|
||||
free(body);
|
||||
body = NULL;
|
||||
body_len = 0;
|
||||
body_cap = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(current_key == NULL)
|
||||
continue;
|
||||
|
||||
if(body_len > 0)
|
||||
append_char(&body, &body_len, &body_cap, '\n');
|
||||
append_text(&body, &body_len, &body_cap, line);
|
||||
}
|
||||
|
||||
if(current_key != NULL)
|
||||
set_locale_entry(entries, count, cap, current_key, body != NULL ? body : "");
|
||||
|
||||
free(current_key);
|
||||
free(body);
|
||||
free(mutable_text);
|
||||
}
|
||||
|
||||
static void
|
||||
load_language_list_from_text(const char *text)
|
||||
{
|
||||
char *mutable_text;
|
||||
char *cursor;
|
||||
|
||||
if(text == NULL)
|
||||
return;
|
||||
|
||||
mutable_text = dup_cstr(text);
|
||||
if(mutable_text == NULL)
|
||||
return;
|
||||
|
||||
cursor = mutable_text;
|
||||
while(cursor != NULL && *cursor != '\0') {
|
||||
char *line = cursor;
|
||||
char *eol = strpbrk(cursor, "\r\n");
|
||||
if(eol != NULL) {
|
||||
char line_end = *eol;
|
||||
*eol = '\0';
|
||||
cursor = eol + 1;
|
||||
if((line_end == '\r' && *cursor == '\n') || (line_end == '\n' && *cursor == '\r'))
|
||||
cursor++;
|
||||
} else {
|
||||
cursor = NULL;
|
||||
}
|
||||
|
||||
if(line[0] == '\0' || line[0] == '#')
|
||||
continue;
|
||||
|
||||
char *sep = strchr(line, '|');
|
||||
if(sep == NULL)
|
||||
continue;
|
||||
|
||||
*sep = '\0';
|
||||
const char *code = line;
|
||||
const char *label = sep + 1;
|
||||
if(code[0] == '\0' || label[0] == '\0')
|
||||
continue;
|
||||
|
||||
ensure_language_capacity();
|
||||
if(g_language_count >= g_language_cap)
|
||||
continue;
|
||||
|
||||
g_languages[g_language_count].code = dup_cstr(code);
|
||||
g_languages[g_language_count].label = dup_cstr(label);
|
||||
if(g_languages[g_language_count].code == NULL || g_languages[g_language_count].label == NULL) {
|
||||
free(g_languages[g_language_count].code);
|
||||
free(g_languages[g_language_count].label);
|
||||
g_languages[g_language_count].code = NULL;
|
||||
g_languages[g_language_count].label = NULL;
|
||||
continue;
|
||||
}
|
||||
g_language_count++;
|
||||
}
|
||||
|
||||
free(mutable_text);
|
||||
}
|
||||
|
||||
static int
|
||||
load_file_text_from_paths(const char *relative_path, char **out_text)
|
||||
{
|
||||
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
char *text;
|
||||
|
||||
if(out_text == NULL)
|
||||
return 0;
|
||||
*out_text = NULL;
|
||||
|
||||
text = LoadFileText(relative_path);
|
||||
if(text != NULL) {
|
||||
*out_text = text;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
static const char *prefixes[] = {
|
||||
"",
|
||||
"../",
|
||||
"../../",
|
||||
"../../../",
|
||||
"../../../../",
|
||||
NULL
|
||||
};
|
||||
|
||||
char path[256];
|
||||
|
||||
if(out_text == NULL)
|
||||
return 0;
|
||||
*out_text = NULL;
|
||||
|
||||
for(int i = 0; prefixes[i] != NULL; i++) {
|
||||
snprintf(path, sizeof(path), "%s%s", prefixes[i], relative_path);
|
||||
if(FileExists(path)) {
|
||||
char *text = LoadFileText(path);
|
||||
if(text != NULL) {
|
||||
*out_text = text;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
load_locale_file_for_code(const char *code, char **out_text)
|
||||
{
|
||||
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
|
||||
char path[64];
|
||||
char *text;
|
||||
|
||||
if(out_text == NULL)
|
||||
return 0;
|
||||
*out_text = NULL;
|
||||
|
||||
if(code == NULL || code[0] == '\0')
|
||||
code = "en";
|
||||
|
||||
snprintf(path, sizeof(path), "locales/%s.txt", code);
|
||||
text = LoadFileText(path);
|
||||
if(text != NULL) {
|
||||
*out_text = text;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
static const char *prefixes[] = {
|
||||
"",
|
||||
"../",
|
||||
"../../",
|
||||
"../../../",
|
||||
"../../../../",
|
||||
NULL
|
||||
};
|
||||
char path[64];
|
||||
|
||||
if(out_text == NULL)
|
||||
return 0;
|
||||
*out_text = NULL;
|
||||
|
||||
if(code == NULL || code[0] == '\0')
|
||||
code = "en";
|
||||
|
||||
for(int i = 0; prefixes[i] != NULL; i++) {
|
||||
snprintf(path, sizeof(path), "%slocales/%s.txt", prefixes[i], code);
|
||||
if(FileExists(path)) {
|
||||
char *text = LoadFileText(path);
|
||||
if(text != NULL) {
|
||||
*out_text = text;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(LOTUS_BUILD)
|
||||
static void
|
||||
load_locale_overlay_for_code(LocaleEntry **entries, size_t *count, size_t *cap, const char *scope, const char *code)
|
||||
{
|
||||
char path[96];
|
||||
char *text = NULL;
|
||||
|
||||
if(scope == NULL || scope[0] == '\0')
|
||||
return;
|
||||
if(code == NULL || code[0] == '\0')
|
||||
code = "en";
|
||||
|
||||
snprintf(path, sizeof(path), "locales/%s/%s.txt", scope, code);
|
||||
if(load_file_text_from_paths(path, &text)) {
|
||||
load_locale_text_into(entries, count, cap, text);
|
||||
UnloadFileText(text);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
load_defaults(void)
|
||||
{
|
||||
int has_english = 0;
|
||||
|
||||
for(size_t i = 0; i < g_language_count; i++) {
|
||||
if(g_languages[i].code != NULL && strcmp(g_languages[i].code, "en") == 0) {
|
||||
has_english = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(has_english)
|
||||
return;
|
||||
|
||||
ensure_language_capacity();
|
||||
if(g_language_count < g_language_cap) {
|
||||
g_languages[g_language_count].code = dup_cstr("en");
|
||||
g_languages[g_language_count].label = dup_cstr("English");
|
||||
if(g_languages[g_language_count].code != NULL && g_languages[g_language_count].label != NULL)
|
||||
g_language_count++;
|
||||
else {
|
||||
free(g_languages[g_language_count].code);
|
||||
free(g_languages[g_language_count].label);
|
||||
g_languages[g_language_count].code = NULL;
|
||||
g_languages[g_language_count].label = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_current_code(const char *code)
|
||||
{
|
||||
if(code == NULL || code[0] == '\0')
|
||||
code = "en";
|
||||
snprintf(g_current_code, sizeof(g_current_code), "%s", code);
|
||||
}
|
||||
|
||||
static void
|
||||
load_base_locale(void)
|
||||
{
|
||||
char *text = NULL;
|
||||
if(load_file_text_from_paths("locales/en.txt", &text)) {
|
||||
load_locale_text_into(&g_base_entries, &g_base_count, &g_base_cap, text);
|
||||
UnloadFileText(text);
|
||||
}
|
||||
#if defined(LOTUS_BUILD)
|
||||
load_locale_overlay_for_code(&g_base_entries, &g_base_count, &g_base_cap, "lotus", "en");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
load_registry(void)
|
||||
{
|
||||
char *text = NULL;
|
||||
if(load_file_text_from_paths("locales/index.txt", &text)) {
|
||||
load_language_list_from_text(text);
|
||||
UnloadFileText(text);
|
||||
}
|
||||
load_defaults();
|
||||
}
|
||||
|
||||
static void
|
||||
clear_active_locale(void)
|
||||
{
|
||||
free_locale_entries(&g_active_entries, &g_active_count, &g_active_cap);
|
||||
}
|
||||
|
||||
void
|
||||
locale_init(void)
|
||||
{
|
||||
if(g_loaded)
|
||||
return;
|
||||
|
||||
free_locale_entries(&g_base_entries, &g_base_count, &g_base_cap);
|
||||
free_locale_entries(&g_active_entries, &g_active_count, &g_active_cap);
|
||||
free_languages();
|
||||
load_registry();
|
||||
load_base_locale();
|
||||
clear_active_locale();
|
||||
set_current_code("en");
|
||||
g_loaded = 1;
|
||||
}
|
||||
|
||||
int
|
||||
locale_set(const char *code)
|
||||
{
|
||||
char *text = NULL;
|
||||
int found = 0;
|
||||
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
|
||||
if(code == NULL || code[0] == '\0')
|
||||
code = "en";
|
||||
|
||||
if(strcmp(code, "en") == 0) {
|
||||
clear_active_locale();
|
||||
set_current_code("en");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < g_language_count; i++) {
|
||||
if(strcmp(g_languages[i].code, code) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
return 0;
|
||||
|
||||
clear_active_locale();
|
||||
if(load_locale_file_for_code(code, &text)) {
|
||||
load_locale_text_into(&g_active_entries, &g_active_count, &g_active_cap, text);
|
||||
UnloadFileText(text);
|
||||
#if defined(LOTUS_BUILD)
|
||||
load_locale_overlay_for_code(&g_active_entries, &g_active_count, &g_active_cap, "lotus", code);
|
||||
#endif
|
||||
set_current_code(code);
|
||||
return 1;
|
||||
}
|
||||
|
||||
clear_active_locale();
|
||||
set_current_code("en");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
lookup_locale_value(const char *key)
|
||||
{
|
||||
const char *value;
|
||||
|
||||
value = find_locale_entry(g_active_entries, g_active_count, key);
|
||||
if(value != NULL)
|
||||
return value;
|
||||
|
||||
value = find_locale_entry(g_base_entries, g_base_count, key);
|
||||
if(value != NULL)
|
||||
return value;
|
||||
|
||||
return key != NULL ? key : "";
|
||||
}
|
||||
|
||||
const char *
|
||||
locale_get(const char *key)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
return lookup_locale_value(key);
|
||||
}
|
||||
|
||||
void
|
||||
locale_format(char *dst, size_t dst_size, const char *key, ...)
|
||||
{
|
||||
const char *fmt;
|
||||
va_list args;
|
||||
|
||||
if(dst == NULL || dst_size == 0)
|
||||
return;
|
||||
|
||||
fmt = locale_get(key);
|
||||
va_start(args, key);
|
||||
vsnprintf(dst, dst_size, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
int
|
||||
locale_count(void)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
return (int)g_language_count;
|
||||
}
|
||||
|
||||
const char *
|
||||
locale_code_at(int index)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
if(index < 0 || (size_t)index >= g_language_count)
|
||||
return "";
|
||||
return g_languages[index].code != NULL ? g_languages[index].code : "";
|
||||
}
|
||||
|
||||
const char *
|
||||
locale_label_at(int index)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
if(index < 0 || (size_t)index >= g_language_count)
|
||||
return "";
|
||||
return g_languages[index].label != NULL ? g_languages[index].label : "";
|
||||
}
|
||||
|
||||
int
|
||||
locale_index_of(const char *code)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
if(code == NULL)
|
||||
return -1;
|
||||
for(size_t i = 0; i < g_language_count; i++) {
|
||||
if(g_languages[i].code != NULL && strcmp(g_languages[i].code, code) == 0)
|
||||
return (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *
|
||||
locale_current_code(void)
|
||||
{
|
||||
if(!g_loaded)
|
||||
locale_init();
|
||||
return g_current_code;
|
||||
}
|
||||
|
||||
int
|
||||
locale_current_index(void)
|
||||
{
|
||||
return locale_index_of(locale_current_code());
|
||||
}
|
||||
/*
|
||||
* Locale implementation now lives in vendor/flint/src/flint_locale.c.
|
||||
* This file stays as a compatibility stub so the legacy include path keeps working.
|
||||
*/
|
||||
@@ -1,18 +1,6 @@
|
||||
#ifndef INBE_LOCALE_H
|
||||
#define INBE_LOCALE_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void locale_init(void);
|
||||
int locale_set(const char *code);
|
||||
const char *locale_get(const char *key);
|
||||
void locale_format(char *dst, size_t dst_size, const char *key, ...);
|
||||
|
||||
int locale_count(void);
|
||||
const char *locale_code_at(int index);
|
||||
const char *locale_label_at(int index);
|
||||
int locale_index_of(const char *code);
|
||||
const char *locale_current_code(void);
|
||||
int locale_current_index(void);
|
||||
#include "flint_locale.h"
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "raylib.h"
|
||||
#include "app.h"
|
||||
#include "ui/dpi.h"
|
||||
#include "flint_dpi.h"
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -37,6 +37,17 @@ void set_global_inbe_app(InbeApp *app);
|
||||
|
||||
#if INBE_ANDROID_BUILD
|
||||
static AndroidInsets insets;
|
||||
|
||||
static int
|
||||
android_clamp_content_size(int size, int leading_inset, int trailing_inset)
|
||||
{
|
||||
int content_size = size - leading_inset - trailing_inset;
|
||||
|
||||
if(content_size <= 0)
|
||||
return size;
|
||||
|
||||
return content_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(PLATFORM_WEB)
|
||||
@@ -80,10 +91,10 @@ frame(void)
|
||||
int safe_left = insets.cutout_left;
|
||||
int safe_right = insets.cutout_right;
|
||||
|
||||
int content_x = safe_left;
|
||||
int content_y = safe_top;
|
||||
int content_width = width - safe_left - safe_right;
|
||||
int content_height = height - safe_top - safe_bottom;
|
||||
int content_x = 0;
|
||||
int content_y = 0;
|
||||
int content_width = android_clamp_content_size(width, safe_left, safe_right);
|
||||
int content_height = android_clamp_content_size(height, safe_top, safe_bottom);
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
@@ -145,7 +156,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
InitWindow(window_w, window_h, config.title);
|
||||
|
||||
dpi_init();
|
||||
flint_dpi_init();
|
||||
inbe_app_init(&inbe_app);
|
||||
set_global_inbe_app(&inbe_app);
|
||||
TraceLog(LOG_INFO, "INBE: Global app pointer set");
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "app.h"
|
||||
#include "data.h"
|
||||
#include "locale.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/text_layout.h"
|
||||
#include "flint_ui.h"
|
||||
#include "flint_text_layout.h"
|
||||
#include "raylib.h"
|
||||
|
||||
#include <dirent.h>
|
||||
@@ -278,19 +278,19 @@ draw_history_row(InbeApp *app, int x, int y, int w, int h, const char *text, int
|
||||
int hover = 0;
|
||||
|
||||
if(mx > x && mx < x + w && my > y && my < y + h) {
|
||||
DrawRectangle(x, y, w, h, selected ? c_button_hover : ui_darken(c_button_hover, 6));
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
DrawRectangle(x, y, w, h, selected ? c_button_hover : flint_darken(c_button_hover, 6));
|
||||
ui_draw_bevel(x, y, w, h, flint_darken(c_button_hover, 40), flint_lighten(c_button_hover, 40));
|
||||
hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button_hover, 40), flint_darken(c_button_hover, 40));
|
||||
}
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, selected ? c_button : ui_darken(c_bg, 6));
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 28), ui_darken(c_button, 20));
|
||||
DrawRectangle(x, y, w, h, selected ? c_button : flint_darken(c_bg, 6));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button, 28), flint_darken(c_button, 20));
|
||||
}
|
||||
|
||||
DrawText(text, x + ui_px(indent), y + ui_px(6), ui_clamp_px(14, 12, 16), c_text);
|
||||
flint_text_draw(text, x + flint_px(indent), y + flint_px(6), flint_px(16), c_text);
|
||||
return hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
|
||||
@@ -302,22 +302,22 @@ draw_history_session_row(InbeApp *app, int x, int y, int w, int h, const char *t
|
||||
int mx = (int)mouse_world.x;
|
||||
int my = (int)mouse_world.y;
|
||||
int hover = 0;
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int font = flint_px(16);
|
||||
|
||||
if(mx > x && mx < x + w && my > y && my < y + h) {
|
||||
DrawRectangle(x, y, w, h, selected ? c_button_hover : ui_darken(c_button_hover, 6));
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
DrawRectangle(x, y, w, h, selected ? c_button_hover : flint_darken(c_button_hover, 6));
|
||||
ui_draw_bevel(x, y, w, h, flint_darken(c_button_hover, 40), flint_lighten(c_button_hover, 40));
|
||||
hover = 1;
|
||||
app->cursor_clickable = 1;
|
||||
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button_hover, 40), flint_darken(c_button_hover, 40));
|
||||
}
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, selected ? c_button : ui_darken(c_bg, 6));
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 28), ui_darken(c_button, 20));
|
||||
DrawRectangle(x, y, w, h, selected ? c_button : flint_darken(c_bg, 6));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button, 28), flint_darken(c_button, 20));
|
||||
}
|
||||
|
||||
DrawText(text, x + ui_px(46), y + ui_px(6), font, c_text);
|
||||
flint_text_draw(text, x + flint_px(46), y + flint_px(6), font, c_text);
|
||||
|
||||
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||
return 1;
|
||||
@@ -327,16 +327,16 @@ draw_history_session_row(InbeApp *app, int x, int y, int w, int h, const char *t
|
||||
static int
|
||||
draw_history_day_row(InbeApp *app, int x, int y, int w, int h, const char *text, int selected)
|
||||
{
|
||||
int icon_size = ui_clamp_px(16, 14, 20);
|
||||
int icon_padding = ui_px(4);
|
||||
int icon_size = flint_px(16);
|
||||
int icon_padding = flint_px(4);
|
||||
int icon_btn_w = icon_size + icon_padding * 2;
|
||||
int edit_x = x + w - icon_btn_w - ui_px(4);
|
||||
int edit_x = x + w - icon_btn_w - flint_px(4);
|
||||
int edit_hover = 0;
|
||||
|
||||
if(draw_history_row(app, x, y, w - icon_btn_w - ui_px(8), h, text, selected, 34))
|
||||
if(draw_history_row(app, x, y, w - icon_btn_w - flint_px(8), h, text, selected, 34))
|
||||
return 1;
|
||||
|
||||
if(ui_draw_icon_btn_padded(app, edit_x, y + (h - icon_btn_w) / 2, icon_size, icon_padding,
|
||||
if(ui_draw_icon_btn_padded(edit_x, y + (h - icon_btn_w) / 2, icon_size, icon_padding,
|
||||
app->pencil_icon, UI_ICON_TYPE_PENCIL, &edit_hover))
|
||||
return 2;
|
||||
|
||||
@@ -347,14 +347,15 @@ static int
|
||||
draw_history_action_button(InbeApp *app, int right_x, int y, int row_h, int slot,
|
||||
Texture2D icon, UIIconType icon_type)
|
||||
{
|
||||
int icon_size = ui_clamp_px(16, 14, 20);
|
||||
int icon_padding = ui_px(4);
|
||||
(void)app;
|
||||
int icon_size = flint_px(16);
|
||||
int icon_padding = flint_px(4);
|
||||
int btn_w = icon_size + icon_padding * 2;
|
||||
int gap = ui_px(4);
|
||||
int gap = flint_px(4);
|
||||
int hover = 0;
|
||||
int x = right_x - (slot + 1) * btn_w - (slot + 1) * gap;
|
||||
|
||||
return ui_draw_icon_btn_padded(app, x, y + (row_h - btn_w) / 2,
|
||||
return ui_draw_icon_btn_padded(x, y + (row_h - btn_w) / 2,
|
||||
icon_size, icon_padding, icon, icon_type,
|
||||
&hover);
|
||||
}
|
||||
@@ -592,9 +593,9 @@ history_edit_cursor_from_x(const char *text, int font, int text_x, int target_x)
|
||||
int right_w;
|
||||
|
||||
snprintf(prefix, sizeof(prefix), "%.*s", i, text);
|
||||
left_w = MeasureText(prefix, font);
|
||||
left_w = flint_text_measure(prefix, font);
|
||||
snprintf(prefix, sizeof(prefix), "%.*s", i + 1, text);
|
||||
right_w = MeasureText(prefix, font);
|
||||
right_w = flint_text_measure(prefix, font);
|
||||
|
||||
if(target_x < text_x + (left_w + right_w) / 2)
|
||||
return i;
|
||||
@@ -682,9 +683,9 @@ history_should_show_keyboard(const InbeApp *app)
|
||||
static int
|
||||
history_keyboard_height(void)
|
||||
{
|
||||
int key_h = ui_clamp_px(42, 38, 54);
|
||||
int gap = ui_px(6);
|
||||
int pad = ui_px(10);
|
||||
int key_h = flint_px(48);
|
||||
int gap = flint_px(6);
|
||||
int pad = flint_px(10);
|
||||
return pad * 2 + key_h * 4 + gap * 3;
|
||||
}
|
||||
|
||||
@@ -693,25 +694,25 @@ history_keyboard_key(InbeApp *app, int x, int y, int w, int h, const char *label
|
||||
{
|
||||
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
Rectangle bounds = {(float)x, (float)y, (float)w, (float)h};
|
||||
int font = ui_clamp_px(16, 14, 18);
|
||||
int font = flint_px(16);
|
||||
int text_w;
|
||||
int pressed = 0;
|
||||
|
||||
if(CheckCollisionPointRec(mouse_world, bounds)) {
|
||||
DrawRectangle(x, y, w, h, c_button_hover);
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_button_hover, 40), ui_lighten(c_button_hover, 40));
|
||||
ui_draw_bevel(x, y, w, h, flint_darken(c_button_hover, 40), flint_lighten(c_button_hover, 40));
|
||||
app->cursor_clickable = 1;
|
||||
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button_hover, 40), ui_darken(c_button_hover, 40));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button_hover, 40), flint_darken(c_button_hover, 40));
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||
pressed = 1;
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, c_button);
|
||||
ui_draw_bevel(x, y, w, h, ui_lighten(c_button, 40), ui_darken(c_button, 40));
|
||||
ui_draw_bevel(x, y, w, h, flint_lighten(c_button, 40), flint_darken(c_button, 40));
|
||||
}
|
||||
|
||||
text_w = MeasureText(label, font);
|
||||
DrawText(label, x + (w - text_w) / 2, y + (h - font) / 2 - 1, font, c_text);
|
||||
text_w = flint_text_measure(label, font);
|
||||
flint_text_draw(label, x + (w - text_w) / 2, y + (h - font) / 2 - 1, font, c_text);
|
||||
return pressed;
|
||||
}
|
||||
|
||||
@@ -725,16 +726,16 @@ history_draw_keyboard(InbeApp *app, const HistoryEntry *entry)
|
||||
"DEL", "0", "OK"
|
||||
};
|
||||
int keyboard_h = history_keyboard_height();
|
||||
int pad = ui_px(10);
|
||||
int gap = ui_px(6);
|
||||
int key_h = ui_clamp_px(42, 38, 54);
|
||||
int x = ui_page_side_padding();
|
||||
int pad = flint_px(10);
|
||||
int gap = flint_px(6);
|
||||
int key_h = flint_px(48);
|
||||
int x = flint_page_side_padding();
|
||||
int y = view_height - keyboard_h;
|
||||
int w = view_width - x * 2;
|
||||
int key_w = (w - gap * 2) / 3;
|
||||
|
||||
DrawRectangle(0, y, view_width, keyboard_h, ui_darken(c_bg, 10));
|
||||
DrawLine(0, y, view_width, y, ui_darken(c_bg, 42));
|
||||
DrawRectangle(0, y, view_width, keyboard_h, flint_darken(c_bg, 10));
|
||||
DrawLine(0, y, view_width, y, flint_darken(c_bg, 42));
|
||||
|
||||
for(int i = 0; i < 12; i++) {
|
||||
int col = i % 3;
|
||||
@@ -828,12 +829,12 @@ history_update_edit_input(InbeApp *app, const HistoryEntry *entry,
|
||||
static void
|
||||
history_draw_edit_field(InbeApp *app, const HistoryEntry *entry, int x, int y, int w, int h)
|
||||
{
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int font = flint_px(16);
|
||||
int valid = 0;
|
||||
int field_y = y + ui_px(3);
|
||||
int field_h = h - ui_px(6);
|
||||
int text_x = x + ui_px(8);
|
||||
int text_y = y + ui_px(7);
|
||||
int field_y = y + flint_px(3);
|
||||
int field_h = h - flint_px(6);
|
||||
int text_x = x + flint_px(8);
|
||||
int text_y = y + flint_px(7);
|
||||
int caret_x;
|
||||
|
||||
history_update_edit_input(app, entry, x, field_y, w, field_h, text_x, font);
|
||||
@@ -852,16 +853,16 @@ history_draw_edit_field(InbeApp *app, const HistoryEntry *entry, int x, int y, i
|
||||
|
||||
history_clamp_edit_cursor(app);
|
||||
|
||||
DrawRectangle(x, field_y, w, field_h, ui_darken(c_bg, 10));
|
||||
DrawRectangle(x, field_y, w, field_h, flint_darken(c_bg, 10));
|
||||
ui_draw_bevel(x, field_y, w, field_h,
|
||||
valid ? ui_lighten(c_button_hover, 35) : ui_lighten(c_button, 16),
|
||||
valid ? ui_darken(c_button_hover, 30) : ui_darken(c_button, 34));
|
||||
DrawText(app->history_edit_text, text_x, text_y, font, c_text);
|
||||
valid ? flint_lighten(c_button_hover, 35) : flint_lighten(c_button, 16),
|
||||
valid ? flint_darken(c_button_hover, 30) : flint_darken(c_button, 34));
|
||||
flint_text_draw(app->history_edit_text, text_x, text_y, font, c_text);
|
||||
if((app->inbe.frame / 24) % 2 == 0) {
|
||||
char prefix[16];
|
||||
snprintf(prefix, sizeof(prefix), "%.*s", app->history_edit_cursor,
|
||||
app->history_edit_text);
|
||||
caret_x = text_x + MeasureText(prefix, font) + ui_px(1);
|
||||
caret_x = text_x + flint_text_measure(prefix, font) + flint_px(1);
|
||||
DrawLine(caret_x, text_y, caret_x, text_y + font, c_text);
|
||||
}
|
||||
}
|
||||
@@ -1067,10 +1068,10 @@ history_format_session_label(const HistoryEntry *entry, char *out, size_t out_si
|
||||
static void
|
||||
history_fit_session_label(const HistoryEntry *entry, int available_w, char *out, size_t out_size)
|
||||
{
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int font = flint_px(16);
|
||||
|
||||
history_format_session_label(entry, out, out_size);
|
||||
if(view_width < 420 && MeasureText(out, font) > available_w)
|
||||
if(view_width < 420 && flint_text_measure(out, font) > available_w)
|
||||
snprintf(out, out_size, "%02d:%02d %ds", entry->hour, entry->minute, entry->avg_seconds);
|
||||
}
|
||||
|
||||
@@ -1081,10 +1082,10 @@ history_tab_draw(InbeApp *app)
|
||||
HistoryEntry *keyboard_entry = NULL;
|
||||
int count = 0;
|
||||
int title_h = ui_screen_header_height();
|
||||
int tab_h = ui_clamp_px(TAB_BAR_H, 54, 66);
|
||||
int tab_h = flint_px(56);
|
||||
int keyboard_h = history_should_show_keyboard(app) ? history_keyboard_height() : 0;
|
||||
int viewport_h = view_height - title_h - tab_h - keyboard_h;
|
||||
int row_h = ui_clamp_px(28, 24, 32);
|
||||
int row_h = flint_px(32);
|
||||
int content_rows = 0;
|
||||
int content_h = 0;
|
||||
int max_scroll;
|
||||
@@ -1168,15 +1169,15 @@ history_tab_draw(InbeApp *app)
|
||||
}
|
||||
|
||||
/* Calculate content height with proper top and bottom padding */
|
||||
content_h = ui_px(12); /* Top padding */
|
||||
content_h = flint_px(12); /* Top padding */
|
||||
if(count > 0) {
|
||||
content_h += count * row_h;
|
||||
} else {
|
||||
content_h += viewport_h;
|
||||
}
|
||||
if(content_rows > 0)
|
||||
content_h = ui_px(12) + content_rows * row_h;
|
||||
content_h += ui_px(12); /* Bottom padding */
|
||||
content_h = flint_px(12) + content_rows * row_h;
|
||||
content_h += flint_px(12); /* Bottom padding */
|
||||
max_scroll = content_h - viewport_h;
|
||||
if(max_scroll < 0 || count == 0)
|
||||
max_scroll = 0;
|
||||
@@ -1186,13 +1187,13 @@ history_tab_draw(InbeApp *app)
|
||||
|
||||
/* Use percentage of screen width like tutorial, not DPI-scaled CONTENT_MAX_W */
|
||||
int responsive_max_w = (int)(view_width * 0.96f);
|
||||
int min_content_w = ui_px(320);
|
||||
int min_content_w = flint_px(320);
|
||||
if(responsive_max_w < min_content_w)
|
||||
responsive_max_w = min_content_w;
|
||||
int side_padding = ui_page_side_padding();
|
||||
ui_centered_column(responsive_max_w, side_padding, &content_x, &content_w);
|
||||
int side_padding = flint_page_side_padding();
|
||||
flint_centered_column(responsive_max_w, side_padding, &content_x, &content_w);
|
||||
|
||||
close_clicked = ui_draw_screen_header(app, locale_get("history_title"), 1);
|
||||
close_clicked = ui_draw_screen_header(locale_get("history_title"), 1);
|
||||
if(close_clicked) {
|
||||
app->inbe.screen = InbeScreenStart;
|
||||
app->history_scroll = 0;
|
||||
@@ -1203,20 +1204,20 @@ history_tab_draw(InbeApp *app)
|
||||
(int)(app->camera.offset.y + title_h * app->camera.zoom),
|
||||
(int)(view_width * app->camera.zoom),
|
||||
(int)(viewport_h * app->camera.zoom));
|
||||
y = title_h + ui_px(12) - app->history_scroll;
|
||||
y = title_h + flint_px(12) - app->history_scroll;
|
||||
if(count == 0) {
|
||||
int font = ui_clamp_px(14, 12, 16);
|
||||
int font = flint_px(16);
|
||||
const char *empty_text = locale_get("history_empty");
|
||||
TextLayout empty_layout = ui_text_layout_parse(empty_text, (Texture2D){0}, UI_ICON_TYPE_NONE, font);
|
||||
ui_text_layout_reflow(&empty_layout, content_w, font, ui_px(22));
|
||||
ui_text_layout_draw(&empty_layout, content_x, &y, font, c_text);
|
||||
ui_text_layout_free(&empty_layout);
|
||||
FlintTextLayout empty_layout = flint_text_layout_parse(empty_text, (Texture2D){0}, FLINT_ICON_TYPE_NONE, font);
|
||||
flint_text_layout_reflow(&empty_layout, content_w, font, flint_px(22));
|
||||
flint_text_layout_draw(&empty_layout, content_x, &y, font, c_text);
|
||||
flint_text_layout_free(&empty_layout);
|
||||
} else {
|
||||
if(app->history_level == HISTORY_LEVEL_EDIT_DAY && has_day) {
|
||||
int return_hover = 0;
|
||||
int icon_size = ui_clamp_px(16, 14, 20);
|
||||
int icon_padding = ui_px(4);
|
||||
if(ui_draw_icon_btn_padded(app, content_x, y + (row_h - icon_size - icon_padding * 2) / 2,
|
||||
int icon_size = flint_px(16);
|
||||
int icon_padding = flint_px(4);
|
||||
if(ui_draw_icon_btn_padded(content_x, y + (row_h - icon_size - icon_padding * 2) / 2,
|
||||
icon_size, icon_padding, app->return_icon,
|
||||
UI_ICON_TYPE_RETURN, &return_hover)) {
|
||||
app->history_level = HISTORY_LEVEL_SESSIONS;
|
||||
@@ -1228,15 +1229,15 @@ history_tab_draw(InbeApp *app)
|
||||
{
|
||||
char label[HISTORY_TEXT_SIZE];
|
||||
locale_format(label, sizeof(label), "history_day_label", app->history_day);
|
||||
DrawText(label, content_x + icon_size + icon_padding * 2 + ui_px(10),
|
||||
y + ui_px(6), ui_clamp_px(14, 12, 16), c_text);
|
||||
flint_text_draw(label, content_x + icon_size + icon_padding * 2 + flint_px(10),
|
||||
y + flint_px(6), flint_px(14), c_text);
|
||||
}
|
||||
y += row_h;
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
char time_label[HISTORY_TEXT_SIZE];
|
||||
int right_edge = content_x + content_w;
|
||||
int label_w = content_w - ui_px(76);
|
||||
int label_w = content_w - flint_px(76);
|
||||
if(entries[i].year != app->history_year ||
|
||||
entries[i].month != app->history_month ||
|
||||
entries[i].day != app->history_day)
|
||||
@@ -1244,10 +1245,10 @@ history_tab_draw(InbeApp *app)
|
||||
|
||||
snprintf(time_label, sizeof(time_label), "%02d:%02d",
|
||||
entries[i].hour, entries[i].minute);
|
||||
DrawRectangle(content_x, y, content_w, row_h, ui_darken(c_bg, 6));
|
||||
ui_draw_bevel(content_x, y, content_w, row_h, ui_lighten(c_button, 28), ui_darken(c_button, 20));
|
||||
DrawRectangle(content_x, y, content_w, row_h, flint_darken(c_bg, 6));
|
||||
ui_draw_bevel(content_x, y, content_w, row_h, flint_lighten(c_button, 28), flint_darken(c_button, 20));
|
||||
if(history_edit_matches(app, &entries[i], HISTORY_EDIT_TIME, -1)) {
|
||||
history_draw_edit_field(app, &entries[i], content_x + ui_px(8), y,
|
||||
history_draw_edit_field(app, &entries[i], content_x + flint_px(8), y,
|
||||
label_w, row_h);
|
||||
if(!app->history_edit_active) {
|
||||
app->history_scroll = 0;
|
||||
@@ -1263,8 +1264,8 @@ history_tab_draw(InbeApp *app)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DrawText(time_label, content_x + ui_px(10), y + ui_px(6),
|
||||
ui_clamp_px(14, 12, 16), c_text);
|
||||
flint_text_draw(time_label, content_x + flint_px(10), y + flint_px(6),
|
||||
flint_px(14), c_text);
|
||||
if(draw_history_action_button(app, right_edge, y, row_h, 1,
|
||||
app->pencil_icon, UI_ICON_TYPE_PENCIL)) {
|
||||
history_begin_edit_time(app, &entries[i]);
|
||||
@@ -1281,11 +1282,11 @@ history_tab_draw(InbeApp *app)
|
||||
for(int r = 0; r < entries[i].round_count; r++) {
|
||||
char round_label[HISTORY_TEXT_SIZE];
|
||||
history_format_round_label(&entries[i], r, round_label, sizeof(round_label));
|
||||
DrawRectangle(content_x, y, content_w, row_h, ui_darken(c_bg, 4));
|
||||
ui_draw_bevel(content_x, y, content_w, row_h, ui_lighten(c_button, 24), ui_darken(c_button, 18));
|
||||
DrawRectangle(content_x, y, content_w, row_h, flint_darken(c_bg, 4));
|
||||
ui_draw_bevel(content_x, y, content_w, row_h, flint_lighten(c_button, 24), flint_darken(c_button, 18));
|
||||
if(history_edit_matches(app, &entries[i], HISTORY_EDIT_ROUND, r)) {
|
||||
history_draw_edit_field(app, &entries[i], content_x + ui_px(20), y,
|
||||
label_w - ui_px(12), row_h);
|
||||
history_draw_edit_field(app, &entries[i], content_x + flint_px(20), y,
|
||||
label_w - flint_px(12), row_h);
|
||||
if(!app->history_edit_active) {
|
||||
app->history_scroll = 0;
|
||||
EndScissorMode();
|
||||
@@ -1300,8 +1301,8 @@ history_tab_draw(InbeApp *app)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DrawText(round_label, content_x + ui_px(22), y + ui_px(6),
|
||||
ui_clamp_px(14, 12, 16), c_text);
|
||||
flint_text_draw(round_label, content_x + flint_px(22), y + flint_px(6),
|
||||
flint_px(14), c_text);
|
||||
if(draw_history_action_button(app, right_edge, y, row_h, 1,
|
||||
app->pencil_icon, UI_ICON_TYPE_PENCIL)) {
|
||||
history_begin_edit_round(app, &entries[i], r);
|
||||
@@ -1393,7 +1394,7 @@ history_tab_draw(InbeApp *app)
|
||||
|
||||
snprintf(record_name, sizeof(record_name), "inbe-%02d%02d%02d",
|
||||
entries[i].hour, entries[i].minute, entries[i].second);
|
||||
history_fit_session_label(&entries[i], content_w - ui_px(56), time_label, sizeof(time_label));
|
||||
history_fit_session_label(&entries[i], content_w - flint_px(56), time_label, sizeof(time_label));
|
||||
selected = strcmp(app->history_record, record_name) == 0;
|
||||
result = draw_history_session_row(app, content_x, y, content_w, row_h, time_label, selected);
|
||||
|
||||
@@ -1423,12 +1424,12 @@ history_tab_draw(InbeApp *app)
|
||||
|
||||
/* Draw scrollbar if needed */
|
||||
if(max_scroll > 0) {
|
||||
int scrollbar_w = ui_clamp_px(6, 4, 8);
|
||||
int scrollbar_w = flint_px(8);
|
||||
int scrollbar_h = (viewport_h * viewport_h) / (content_h + viewport_h);
|
||||
int scrollbar_x = content_x + content_w + ui_px(10);
|
||||
int scrollbar_x = content_x + content_w + flint_px(10);
|
||||
int scrollbar_y = title_h + (app->history_scroll * (viewport_h - scrollbar_h)) / max_scroll;
|
||||
|
||||
DrawRectangle(scrollbar_x, scrollbar_y, scrollbar_w, scrollbar_h, ui_darken(c_text, 40));
|
||||
DrawRectangle(scrollbar_x, scrollbar_y, scrollbar_w, scrollbar_h, flint_darken(c_text, 40));
|
||||
}
|
||||
|
||||
if(history_should_show_keyboard(app) && keyboard_entry != NULL) {
|
||||
@@ -1437,8 +1438,7 @@ history_tab_draw(InbeApp *app)
|
||||
}
|
||||
|
||||
if(app->modal.active && app->modal.type == UIModalConfirmDeleteHistory) {
|
||||
int modal_result = ui_draw_modal(app,
|
||||
locale_get("delete_history_title"),
|
||||
int modal_result = ui_draw_modal(locale_get("delete_history_title"),
|
||||
app->history_delete_kind == HISTORY_DELETE_ROUND
|
||||
? locale_get("delete_round_message")
|
||||
: locale_get("delete_session_message"),
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../libinbe/inbe.h"
|
||||
|
||||
typedef struct InbeApp InbeApp;
|
||||
#include "../app_fwd.h"
|
||||
|
||||
/* History constants */
|
||||
enum {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "app.h"
|
||||
#include "locale.h"
|
||||
#include "ui/ui.h"
|
||||
#include "flint_ui.h"
|
||||
#include "raylib.h"
|
||||
|
||||
extern int view_width;
|
||||
@@ -35,34 +35,36 @@ language_dropdown_button(InbeApp *app, int id, int x, int y, int w, int h, int *
|
||||
|
||||
build_language_options(g_language_options, 64, &g_language_option_count);
|
||||
if(g_language_option_count <= 0) {
|
||||
int font = flint_ui_font();
|
||||
DrawRectangle(x, y, w, h, c_button);
|
||||
ui_draw_bevel(x, y, w, h, ui_darken(c_bg, 30), ui_lighten(c_bg, 20));
|
||||
DrawText(locale_get("language_label"), x + ui_px(12), y + h / 2 - ui_clamp_px(14, 12, 16) / 2 - 1,
|
||||
ui_clamp_px(14, 12, 16), c_text);
|
||||
ui_draw_bevel(x, y, w, h, flint_darken(c_bg, 30), flint_lighten(c_bg, 20));
|
||||
flint_text_draw(locale_get("language_label"), x + flint_px(12),
|
||||
flint_ui_text_y(locale_get("language_label"), y, h, font), font, c_text);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(*selected_index < 0 || *selected_index >= g_language_option_count)
|
||||
*selected_index = 0;
|
||||
|
||||
return ui_draw_dropdown_button(app, id, x, y, w, h, g_language_options, g_language_option_count, selected_index);
|
||||
return ui_draw_dropdown_button(id, x, y, w, h, g_language_options, g_language_option_count, selected_index);
|
||||
}
|
||||
|
||||
int
|
||||
language_dropdown_menu(InbeApp *app, int id)
|
||||
{
|
||||
return ui_draw_dropdown_menu(app, id);
|
||||
(void)app;
|
||||
return ui_draw_dropdown_menu(id);
|
||||
}
|
||||
|
||||
void
|
||||
language_tab_draw(InbeApp *app)
|
||||
{
|
||||
int title_font = ui_clamp_px(22, 18, 26);
|
||||
int label_font = ui_clamp_px(14, 12, 16);
|
||||
int title_font = flint_px(24);
|
||||
int label_font = flint_ui_font();
|
||||
int title_w;
|
||||
int content_x;
|
||||
int content_w;
|
||||
int dropdown_h = ui_px(36);
|
||||
int dropdown_h = flint_px(36);
|
||||
int dropdown_w;
|
||||
int dropdown_x;
|
||||
int dropdown_y;
|
||||
@@ -78,21 +80,21 @@ language_tab_draw(InbeApp *app)
|
||||
if(*selected_index < 0 || *selected_index >= language_count)
|
||||
*selected_index = 0;
|
||||
|
||||
ui_centered_column(ui_px(340), ui_page_side_padding(), &content_x, &content_w);
|
||||
flint_centered_column(flint_px(340), flint_page_side_padding(), &content_x, &content_w);
|
||||
dropdown_w = content_w;
|
||||
dropdown_x = content_x;
|
||||
dropdown_y = view_height / 2 - dropdown_h / 2;
|
||||
button_x = view_width / 2;
|
||||
button_y = dropdown_y + ui_px(64);
|
||||
button_y = dropdown_y + flint_px(64);
|
||||
|
||||
if(language_dropdown_button(app, 200, dropdown_x, dropdown_y, dropdown_w, dropdown_h, selected_index))
|
||||
selection_changed = 1;
|
||||
|
||||
title_w = MeasureText(locale_get("language_picker_title"), title_font);
|
||||
DrawText(locale_get("language_picker_title"), view_width / 2 - title_w / 2, ui_px(28), title_font, c_text);
|
||||
DrawText(locale_get("language_label"), dropdown_x, dropdown_y - ui_px(24), label_font, c_text);
|
||||
title_w = flint_text_measure(locale_get("language_picker_title"), title_font);
|
||||
flint_text_draw(locale_get("language_picker_title"), view_width / 2 - title_w / 2, flint_px(28), title_font, c_text);
|
||||
flint_text_draw(locale_get("language_label"), dropdown_x, dropdown_y - flint_px(24), label_font, c_text);
|
||||
|
||||
if(ui_draw_text_btn(app, button_x, button_y, locale_get("next_button"), &next_hover)) {
|
||||
if(ui_draw_text_btn(button_x, button_y, locale_get("next_button"), &next_hover)) {
|
||||
if(!app->tutorial_seen)
|
||||
app->inbe.screen = InbeScreenManual;
|
||||
else
|
||||
|
||||