Compare commits

...
11 Commits
Author SHA1 Message Date
waozi 1f21d4d3af clean flint version 2026-06-12 00:42:22 -03:00
waozi d92c06a0b4 flint cli fully working 2026-06-12 00:11:22 -03:00
waozi e416d9419a use flint for cross building 2026-06-12 00:07:56 -03:00
waozi 5157746aca clean windows build 2026-06-11 23:45:54 -03:00
waozi 4993ad48e4 Embed runtime assets in desktop builds 2026-06-11 22:20:24 -03:00
waozi efd8de98cd upload all versions on itch 2026-06-11 16:48:08 -03:00
waozi a5729306ae update version 2026-06-11 13:06:54 -03:00
waozi d6373dab29 bug fixes and improve setting management 2026-06-11 13:03:51 -03:00
waozi 91a250a9be fix versioning 2026-06-10 08:41:39 -03:00
waozi 22d2b0916d fix history page 2026-06-10 08:38:18 -03:00
waozi 6a1d83f8f8 simplify scripts 2026-06-10 00:22:12 -03:00
55 changed files with 1046 additions and 1528 deletions

No files matched your search

+15
View File
@@ -1,4 +1,19 @@
# Changelog
## [1.2.5] - 2026-06-12
### Added
- BTC address for donations
## [1.2.4] - 2026-06-11
### Fixed
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
- Dropdown menu text is clipped cleanly while scrolling.
## [1.2.3] - 2026-06-10
### Fixed
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
## [1.2.2] - 2026-06-10
### Fixed
- Android touch targets now align correctly on devices with navigation bar window insets.
+4 -41
View File
@@ -1,44 +1,7 @@
.DEFAULT_GOAL := all
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
FLINT_DIR ?= vendor/flint
FLINT_PROJECT ?= flint.toml
ANDROID_ACTIVITY ?= xyz.waozi.inbe.MainActivity
FORCE:
.PHONY: \
all \
native \
run \
linux \
$(LINUX_ARCHES:%=linux-%) \
build-linux-arch \
windows \
web \
clean \
clean-linux \
clean-windows \
clean-web \
clean-raylib \
dist \
dist-linux \
dist-windows \
install \
uninstall \
android-init-signing \
android-debug \
android-release \
android-bundle \
android-copy-assets \
android-copy-apks \
android-copy-debug-apks \
android-copy-release-apks \
android-copy-bundle \
android-install \
android-install-release \
android-clean \
FORCE
include $(FLINT_DIR)/mk/project.mk
+17 -9
View File
@@ -28,26 +28,33 @@ inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix develop
nix develop
# Build for your current platform (Linux x86_64/aarch64)
make
flint build native
# Run
./build/linux/inbe-linux-$(uname -m)
flint run native
```
### Cross-Platform Builds
```bash
# Linux (both architectures)
make linux
flint build linux
# Windows (from Linux)
make windows
# Windows (x86_64/i686, OpenGL and software renderer variants, from Linux)
flint build windows
# Android APK
make android
# Android debug APK
flint build android
# WebAssembly
make web
flint build web
# Release/package artifacts
flint dist linux # Linux tar.gz with all Linux arch binaries
flint dist windows # Windows zip with all Windows arch/renderer binaries
flint dist android # Signed release APK
flint dist itch # Build release artifacts and publish to itch.io
flint dist # Full release flow
```
### Android Emulator Testing
@@ -57,7 +64,8 @@ For automated testing with camera notch (cutout) support:
```bash
# Enter the development shell and run everything automatically
nix develop
./scripts/emulator.sh # Creates AVD, launches emulator, builds & runs app
./scripts/emulator.sh # Creates and launches the test AVD
flint run android # Builds, installs, and launches the app
```
This single script handles:
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

+3 -3
View File
@@ -34,8 +34,8 @@ android {
defaultConfig {
minSdk 19
targetSdk 35
versionCode 23
versionName "1.2.2"
versionCode 26
versionName "1.2.5"
}
@@ -74,7 +74,7 @@ gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":app:assembleRelease")
&& !project.findProperty('keystore.password')
&& !project.hasProperty('fDroidBuild')) {
throw new GradleException("Use: make android-release PASSWORD=your-password")
throw new GradleException("Use: flint dist android PASSWORD=your-password")
}
}
+27
View File
@@ -9,6 +9,31 @@ 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")
file(GLOB INBE_LOCALE_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/locales/*.txt")
file(GLOB INBE_THEME_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${FLINT_DIR}/themes/*.ini")
file(GLOB INBE_SOUND_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/sounds/*.ogg")
set(INBE_EMBEDDED_INPUTS
${INBE_LOCALE_ASSETS}
${INBE_THEME_ASSETS}
assets/angel.jpg
assets/begin.jpg
assets/fonts/locales.png
assets/fonts/locales.dat
${INBE_SOUND_ASSETS}
)
set(INBE_EMBEDDED_DEPS)
foreach(asset ${INBE_EMBEDDED_INPUTS})
list(APPEND INBE_EMBEDDED_DEPS "${REPO_ROOT}/${asset}")
endforeach()
set(INBE_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/inbe_embedded_assets.c")
add_custom_command(
OUTPUT "${INBE_EMBEDDED_ASSETS_C}"
COMMAND sh "${FLINT_DIR}/scripts/embed-assets.sh" "${INBE_EMBEDDED_ASSETS_C}" ${INBE_EMBEDDED_INPUTS}
DEPENDS "${FLINT_DIR}/scripts/embed-assets.sh" ${INBE_EMBEDDED_DEPS}
WORKING_DIRECTORY "${REPO_ROOT}"
VERBATIM
)
add_library(raylib STATIC
"${RAYLIB_DIR}/rcore.c"
@@ -77,6 +102,7 @@ add_library(main SHARED
"${SRC_DIR}/tabs/language_tab.c"
"${SRC_DIR}/tabs/manual_tab.c"
"${SRC_DIR}/tabs/settings_tab.c"
"${INBE_EMBEDDED_ASSETS_C}"
"${SRC_DIR}/android/android_insets.c"
"${SRC_DIR}/android/android_wakelock.c"
"${SRC_DIR}/android/android_timer.c"
@@ -102,6 +128,7 @@ target_compile_definitions(main PRIVATE
MG_ENABLE_POSIX_FS=0
SUPPORT_MODULE_RAUDIO=1
SUPPORT_FILEFORMAT_OGG=1
FLINT_EMBEDDED_ONLY=1
)
target_compile_options(main PRIVATE
@@ -30,14 +30,17 @@ public class MainActivity extends NativeActivity {
private final int[] cachedInsets = new int[6];
private boolean insetsInitialized = false;
private PowerManager.WakeLock wakeLock = null;
private boolean activityPaused = false;
private boolean windowFocused = true;
private boolean backgroundExecutionActive = false;
private boolean autoPausedForLifecycle = false;
private native void nativeSetInsets(int status, int nav,
int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
private native void nativeWakeLockReady();
private native void nativeTimerActivate();
private native void nativeTimerDeactivate();
private native void nativeSetBackgroundActive(boolean active);
private native int nativeGetPlayInBackground();
private native void nativePauseSession();
private native int nativePauseSession();
private native void nativeResumeSession();
private native void nativeImportSelectedFile(String path);
private native void nativeImportCancelled();
@@ -296,36 +299,52 @@ public class MainActivity extends NativeActivity {
return result;
}
private void syncLifecycleState(String reason) {
int playInBackground = nativeGetPlayInBackground();
boolean shouldRunInBackground = playInBackground != 0 && (activityPaused || !windowFocused);
Log.d(TAG, reason + ": play_in_background=" + playInBackground
+ " activityPaused=" + activityPaused
+ " windowFocused=" + windowFocused
+ " backgroundActive=" + backgroundExecutionActive);
if (backgroundExecutionActive != shouldRunInBackground) {
nativeSetBackgroundActive(shouldRunInBackground);
backgroundExecutionActive = shouldRunInBackground;
}
if (playInBackground == 0) {
if (activityPaused && !autoPausedForLifecycle) {
autoPausedForLifecycle = nativePauseSession() != 0;
} else if (!activityPaused && autoPausedForLifecycle) {
nativeResumeSession();
autoPausedForLifecycle = false;
}
} else if (autoPausedForLifecycle) {
nativeResumeSession();
autoPausedForLifecycle = false;
}
}
@Override
protected void onPause() {
super.onPause();
int playInBackground = nativeGetPlayInBackground();
Log.d(TAG, "onPause: play_in_background = " + playInBackground);
if (playInBackground == 0) {
// Auto-pause if play in background is disabled
Log.d(TAG, "onPause: Auto-pausing session (play in background disabled)");
nativePauseSession();
} else {
// Continue in background
Log.d(TAG, "onPause: Continuing in background (play in background enabled)");
nativeTimerActivate();
}
activityPaused = true;
syncLifecycleState("onPause");
}
@Override
protected void onResume() {
super.onResume();
int playInBackground = nativeGetPlayInBackground();
Log.d(TAG, "onResume: play_in_background = " + playInBackground);
if (playInBackground == 0) {
// Auto-resume if play in background is disabled
Log.d(TAG, "onResume: Auto-resuming session (play in background disabled)");
nativeResumeSession();
} else {
// Just deactivate timer (session continued in background)
Log.d(TAG, "onResume: Deactivating background timer");
nativeTimerDeactivate();
}
activityPaused = false;
syncLifecycleState("onResume");
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
windowFocused = hasFocus;
syncLifecycleState("onWindowFocusChanged");
}
@Override
@@ -0,0 +1,2 @@
### Fixed
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
@@ -0,0 +1,5 @@
### Fixed
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
- Dropdown menu text is clipped cleanly while scrolling.
@@ -0,0 +1,2 @@
### Added
- BTC address for donations
+21
View File
@@ -39,7 +39,17 @@
};
};
mingw32Pkgs = import nixpkgs {
inherit system;
crossSystem = { config = "i686-w64-mingw32"; };
config = {
allowUnfree = true;
allowUnsupportedSystem = true;
};
};
mcfgthreads = pkgs.pkgsCross.mingwW64.windows.mcfgthreads;
mcfgthreads32 = pkgs.pkgsCross.mingw32.windows.mcfgthreads;
androidComposition = pkgs.androidenv.composeAndroidPackages {
cmdLineToolsVersion = "11.0";
@@ -75,6 +85,9 @@
mingwPkgs.buildPackages.gcc
mingwPkgs.windows.mingw_w64
mcfgthreads
mingw32Pkgs.buildPackages.gcc
mingw32Pkgs.windows.mingw_w64
mcfgthreads32
];
windowsProfile = pkgs.lib.optionalString windowsCrossEnabled ''
@@ -85,7 +98,15 @@
export WIN_WINDRES="x86_64-w64-mingw32-windres"
export WIN_STRIP="x86_64-w64-mingw32-strip"
export WIN32_CC="i686-w64-mingw32-gcc"
export WIN32_CXX="i686-w64-mingw32-g++"
export WIN32_AR="i686-w64-mingw32-ar"
export WIN32_RANLIB="i686-w64-mingw32-ranlib"
export WIN32_WINDRES="i686-w64-mingw32-windres"
export WIN32_STRIP="i686-w64-mingw32-strip"
export MCFGTHREADS="${mcfgthreads}"
export WIN32_MCFGTHREADS="${mcfgthreads32}"
export CPATH="$MCFGTHREADS/include:$CPATH"
export LIBRARY_PATH="$MCFGTHREADS/lib:$LIBRARY_PATH"
export LDFLAGS="-L$MCFGTHREADS/lib $LDFLAGS"
+84
View File
@@ -0,0 +1,84 @@
[app]
name = "inbe"
title = "Inner Breeze"
id = "xyz.waozi.inbe"
version_header = "src/version.h"
[paths]
raylib = "vendor/raylib/src"
flint = "vendor/flint"
core_library = "libinbe"
android_project = "droid"
[sources]
app = [
"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"
]
core = ["libinbe/inbe.c"]
include_dirs = ["src", "src/android", "libinbe"]
[assets]
locales = "locales/*.txt"
themes = "vendor/flint/themes/*.ini"
images = ["assets/angel.jpg", "assets/begin.jpg"]
sounds = [
"assets/sounds/breath-in.ogg",
"assets/sounds/breath-out.ogg",
"assets/sounds/bell.ogg"
]
generated_fonts = ["assets/fonts/locales.png", "assets/fonts/locales.dat"]
font_tool = "vendor/otfchop/otfchop"
font_source = "vendor/otfchop/unifont-17.0.04.otf"
[raylib]
modules = ["core", "shapes", "textures", "text", "audio"]
audio = true
models = false
graphics = "gles2"
formats = ["jpg", "png", "ogg"]
[platform.linux]
arches = ["x86_64", "aarch64"]
backend = "sdl"
[platform.windows]
arches = ["x86_64", "i686"]
renderers = ["opengl", "rlsw"]
[platform.web]
shell = "src/web_shell.html"
public = ["manifest.json", "web-assets"]
[platform.android]
min_sdk = 19
target_sdk = 35
compile_sdk = 35
abis = ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
activity = "xyz.waozi.inbe.MainActivity"
sources = [
"src/android/android_import.c",
"src/android/android_share.c",
"src/android/android_insets.c",
"src/android/android_wakelock.c",
"src/android/android_timer.c"
]
[dist.itch]
user = "waozi"
game = "inbe"
web_channel = "html5"
windows_channel = "windows"
linux_channel = "linux"
android_channel = "android"
-5
View File
@@ -1,5 +0,0 @@
# Inbe app configuration
name "inbe"
title "Inner Breeze"
width 320
height 560
+1 -1
View File
@@ -79,7 +79,7 @@
<h1>Inner Breeze</h1>
<p>guided breathing meditation based on the Wim Hof method</p>
<p class="version">1.2.2</p>
<p class="version">1.2.5</p>
<!-- Direct Downloads -->
<nav aria-label="Platform downloads" class="platform-buttons">
+2 -2
View File
@@ -80,7 +80,7 @@ inbeinit(Inbe *l)
l->rmin = 25;
l->rmax = 50;
l->dir = 0;
l->speed_level = 3;
l->speed_level = DefaultSpeedLevel;
l->breath_frame = 0;
l->breath_half_ticks = 120;
l->frame = 0;
@@ -90,7 +90,7 @@ inbeinit(Inbe *l)
l->max_rounds = DefaultMaxRounds;
l->pause_seconds = DefaultPauseSeconds;
l->progressive_speed = 1;
l->progressive_start_speed = 3;
l->progressive_start_speed = DefaultProgressiveStartSpeed;
#ifdef __ANDROID__
l->play_in_background = 1; // Enabled by default on Android
#else
+3 -1
View File
@@ -22,9 +22,11 @@ enum {
enum {
CountSize = 4,
MaxRounds = 12,
DefaultSpeedLevel = 6,
DefaultMaxRounds = 4,
DefaultMaxBreaths = 30,
DefaultPauseSeconds = 2
DefaultPauseSeconds = 2,
DefaultProgressiveStartSpeed = 3
};
enum {
+11 -2
View File
@@ -112,8 +112,17 @@ Motiv
[speed_label]
Rychlost
---
Start speed
[progressive_speed_label]
Progresivni rychlost
---
[progressive_start_speed_label]
Pocatecni rychlost
---
[modify_start_speed_button]
Upravit pocatecni rychlost
---
[progressive_start_speed_editor_title]
Pocatecni rychlost
---
[play_in_background_label]
Přehrávat na pozadí
+11 -2
View File
@@ -94,8 +94,17 @@ Thema
[speed_label]
Geschwindigkeit
---
Start speed
[progressive_speed_label]
Progressive Geschwindigkeit
---
[progressive_start_speed_label]
Startgeschwindigkeit
---
[modify_start_speed_button]
Startgeschwindigkeit andern
---
[progressive_start_speed_editor_title]
Startgeschwindigkeit
---
[play_in_background_label]
Im Hintergrund abspielen
+6
View File
@@ -118,6 +118,12 @@ Progressive speed
[progressive_start_speed_label]
Start speed
---
[modify_start_speed_button]
Modify start speed
---
[progressive_start_speed_editor_title]
Start speed
---
[play_in_background_label]
Play in background
---
+11 -2
View File
@@ -94,8 +94,17 @@ Tema
[speed_label]
Velocidad
---
Start speed
[progressive_speed_label]
Velocidad progresiva
---
[progressive_start_speed_label]
Velocidad inicial
---
[modify_start_speed_button]
Modificar velocidad inicial
---
[progressive_start_speed_editor_title]
Velocidad inicial
---
[play_in_background_label]
Reproducir en segundo plano
+11 -2
View File
@@ -94,8 +94,17 @@ Thème
[speed_label]
Vitesse
---
Start speed
[progressive_speed_label]
Vitesse progressive
---
[progressive_start_speed_label]
Vitesse de depart
---
[modify_start_speed_button]
Modifier la vitesse de depart
---
[progressive_start_speed_editor_title]
Vitesse de depart
---
[play_in_background_label]
Lecture en arrière-plan
+11 -2
View File
@@ -112,8 +112,17 @@ Tema
[speed_label]
Kecepatan
---
Start speed
[progressive_speed_label]
Kecepatan progresif
---
[progressive_start_speed_label]
Kecepatan awal
---
[modify_start_speed_button]
Ubah kecepatan awal
---
[progressive_start_speed_editor_title]
Kecepatan awal
---
[play_in_background_label]
Putar di latar belakang
+11 -2
View File
@@ -112,8 +112,17 @@
[speed_label]
速度
---
Start speed
[progressive_speed_label]
プログレッシブ速度
---
[progressive_start_speed_label]
開始速度
---
[modify_start_speed_button]
開始速度を変更
---
[progressive_start_speed_editor_title]
開始速度
---
[play_in_background_label]
バックグラウンド再生
+8 -2
View File
@@ -94,8 +94,14 @@
[speed_label]
속도
---
Start speed
[progressive_start_speed_label]
시작 속도
---
[modify_start_speed_button]
시작 속도 수정
---
[progressive_start_speed_editor_title]
시작 속도
---
[play_in_background_label]
백그라운드 재생
+11 -2
View File
@@ -94,8 +94,17 @@ Tema
[speed_label]
Velocidade
---
Start speed
[progressive_speed_label]
Velocidade progressiva
---
[progressive_start_speed_label]
Velocidade inicial
---
[modify_start_speed_button]
Modificar velocidade inicial
---
[progressive_start_speed_editor_title]
Velocidade inicial
---
[play_in_background_label]
Executar em segundo plano
+11 -2
View File
@@ -112,8 +112,17 @@
[speed_label]
速度
---
Start speed
[progressive_speed_label]
渐进速度
---
[progressive_start_speed_label]
起始速度
---
[modify_start_speed_button]
修改起始速度
---
[progressive_start_speed_editor_title]
起始速度
---
[play_in_background_label]
后台播放
+22
View File
@@ -0,0 +1,22 @@
{
"name": "Inner Breeze",
"short_name": "Inner Breeze",
"description": "Guided breathing meditation based on the Wim Hof method.",
"start_url": "/build/web/index.html",
"scope": "/",
"display": "standalone",
"background_color": "#1a1a2e",
"theme_color": "#779999",
"icons": [
{
"src": "/web-assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/web-assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
-153
View File
@@ -1,153 +0,0 @@
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)
-18
View File
@@ -1,18 +0,0 @@
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
-114
View File
@@ -1,114 +0,0 @@
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 $@
-135
View File
@@ -1,135 +0,0 @@
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"
-107
View File
@@ -1,107 +0,0 @@
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)
-64
View File
@@ -1,64 +0,0 @@
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)
-64
View File
@@ -1,64 +0,0 @@
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)
-44
View File
@@ -1,44 +0,0 @@
#!/bin/bash
# Publish inbe HTML5 to itch.io using butler
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Check if butler is installed
if ! command -v butler &> /dev/null; then
echo "Error: 'butler' command not found"
echo "Install it from: https://itch.io/docs/butler/"
exit 1
fi
WEB_BUILD_DIR="build/web"
# Verify the web build exists
if [ ! -f "$WEB_BUILD_DIR/index.html" ]; then
echo "Error: Web build not found at $WEB_BUILD_DIR/index.html"
echo "Run 'make web' first."
exit 1
fi
# Read version from src/version.h
VERSION=$(grep INBE_VERSION_STRING src/version.h | grep -o '"[^"]*"' | tr -d '"')
if [ -z "$VERSION" ]; then
echo "Error: Could not determine version from src/version.h"
exit 1
fi
ITCH_USER="waozi"
ITCH_GAME="inbe"
ITCH_CHANNEL="html5"
echo "Publishing inbe v$VERSION ($ITCH_CHANNEL) to itch.io..."
echo " User: $ITCH_USER"
echo " Game: $ITCH_GAME"
echo " Channel: $ITCH_CHANNEL"
echo " Build dir: $WEB_BUILD_DIR"
echo ""
butler push "$WEB_BUILD_DIR" "$ITCH_USER/$ITCH_GAME:$ITCH_CHANNEL" --userversion "$VERSION"
echo "✓ Published inbe v$VERSION to https://$ITCH_USER.itch.io/$ITCH_GAME"
+32 -64
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Publish inbe site to inbe.waozi.xyz
set -e
@@ -15,69 +15,36 @@ fi
echo "Publishing inbe.waozi.xyz..."
# Update metadata before publishing
if [ -f "./update_metadata.sh" ]; then
echo "Running metadata update..."
./update_metadata.sh || echo "Warning: Metadata update failed, continuing anyway"
else
echo "Warning: update_metadata.sh not found, skipping metadata update"
fi
TMPDIR=$(mktemp -d -p /tmp)
cleanup() {
rm -rf "$TMPDIR"
rm -f "$SITE_DIR/inbe.tar.gz"
if [ "${PACKAGE_ONLY:-0}" != "1" ]; then
rm -f "$SITE_DIR/inbe.tar.gz"
fi
}
trap cleanup EXIT
# Base site files
rsync -av --delete \
--exclude='local.properties' \
--exclude='.git' \
--exclude='*.sym' \
--exclude='*.o' \
--exclude='*.a' \
--exclude='*.d' \
--exclude='*.9' \
--exclude='*.8' \
--exclude='build' \
--exclude='.gradle' \
--exclude='.idea' \
--exclude='node_modules' \
--exclude='*.iml' \
--exclude='.cxx' \
--exclude='.externalNativeBuild' \
--exclude='Captures' \
--exclude='.DS_Store' \
--exclude='Thumbs.db' \
--exclude='.xdp-*' \
--exclude='*.bak' \
--exclude='*.swp' \
--exclude='*.lock' \
--exclude='assets' \
--exclude='icons' \
--exclude='site-icons' \
--exclude='gradlew' \
--exclude='gradlew.bat' \
--exclude='shell.nix' \
--exclude='flake.nix' \
--exclude='flake.lock' \
--exclude='Makefile' \
--exclude='gradle' \
--exclude='codex' \
--exclude='.codex' \
--exclude='.npm' \
--exclude='.local' \
--exclude='droid' \
--exclude='vendor' \
. "$TMPDIR/"
# Base site files. Keep this as an allowlist so source/build inputs never leak
# into the published archive.
for site_file in \
index.html \
builds.html \
privacy.html \
legacy-converter.html \
style.css \
og.png \
og.jpg \
sitemap.xml \
robots.txt \
manifest.json; do
[ -f "$site_file" ] && cp "$site_file" "$TMPDIR/"
done
mkdir -p "$TMPDIR/rc"
[ -f "rc/inbe.rc" ] && cp rc/inbe.rc "$TMPDIR/rc/"
[ -d "web-assets" ] && rsync -a web-assets/ "$TMPDIR/web-assets/"
mkdir -p "$TMPDIR/uxn/devices"
[ -f "uxn/index.html" ] && cp uxn/index.html "$TMPDIR/uxn/"
[ -f "uxn/inbe.rom" ] && cp uxn/inbe.* "$TMPDIR/uxn/"
[ -f "uxn/inbe.rom" ] && cp uxn/inbe.rom "$TMPDIR/uxn/"
if [ -d "uxn/devices" ]; then
rsync -av --exclude='*.sym' uxn/devices/*.js "$TMPDIR/uxn/devices/" 2>/dev/null || true
fi
@@ -90,18 +57,18 @@ if [ -d "build/web" ]; then
[ -f "$raylib_web_artifact" ] && cp "$raylib_web_artifact" "$TMPDIR/build/web/"
done
fi
if [ -d "build/linux" ]; then
for raylib_linux_artifact in build/linux/inbe-linux-* build/linux/inbe-linux.tar.gz; do
if [ -d "build/bin/linux" ] || [ -d "build/dist/linux" ]; then
for raylib_linux_artifact in build/bin/linux/inbe-linux-* build/dist/linux/inbe-linux.tar.gz; do
[ -f "$raylib_linux_artifact" ] && cp "$raylib_linux_artifact" "$TMPDIR/build/linux/"
done
fi
if [ -d "build/windows" ]; then
for raylib_windows_artifact in build/windows/inbe-windows-* build/windows/inbe-windows.zip; do
if [ -d "build/bin/windows" ] || [ -d "build/dist/windows" ]; then
for raylib_windows_artifact in build/bin/windows/inbe-windows-*.exe build/dist/windows/inbe-windows.zip; do
[ -f "$raylib_windows_artifact" ] && cp "$raylib_windows_artifact" "$TMPDIR/build/windows/"
done
fi
if [ -d "build/android" ]; then
for raylib_android_artifact in build/android/*.apk; do
for raylib_android_artifact in build/android/inbe-*.apk build/android/inbe-latest.apk build/android/app-universal-release.apk; do
[ -f "$raylib_android_artifact" ] && cp "$raylib_android_artifact" "$TMPDIR/build/android/"
done
fi
@@ -112,9 +79,6 @@ mkdir -p "$TMPDIR/wasm4/build"
for wasm4_artifact in wasm4/build/inbe-x86_64 wasm4/build/inbe-x86_64.exe wasm4/build/inbe-windows.zip wasm4/build/inbe-linux.tar.gz; do
[ -f "$wasm4_artifact" ] && cp "$wasm4_artifact" "$TMPDIR/wasm4/build/"
done
[ -d "wasm4/src" ] && rsync -av --exclude='*.o' --exclude='*.d' --exclude='.npm' --exclude='.local' --exclude='.codex' wasm4/src/ "$TMPDIR/wasm4/src/"
[ -f "wasm4/Makefile" ] && cp wasm4/Makefile "$TMPDIR/wasm4/"
[ -f "wasm4/shell.nix" ] && cp wasm4/shell.nix "$TMPDIR/wasm4/"
[ -f "wasm4/README.md" ] && cp wasm4/README.md "$TMPDIR/wasm4/"
mkdir -p "$TMPDIR/linux/build"
@@ -134,8 +98,7 @@ mkdir -p "$TMPDIR/tcl"
# Compatibility copy for older Android links.
mkdir -p "$TMPDIR/droid"
[ -f "build/android/app-universal-release.apk" ] && cp build/android/app-universal-release.apk "$TMPDIR/droid/app-release.apk"
cp style.css og.png sitemap.xml robots.txt "$TMPDIR/"
[ -f "build/android/inbe-latest.apk" ] && cp build/android/inbe-latest.apk "$TMPDIR/droid/app-release.apk"
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' \
@@ -153,6 +116,11 @@ if [ ! -f "$SITE_DIR/inbe.tar.gz" ]; then
exit 1
fi
if [ "${PACKAGE_ONLY:-0}" = "1" ]; then
echo "✓ Package created at $SITE_DIR/inbe.tar.gz"
exit 0
fi
hut pages publish -d inbe.waozi.xyz "$SITE_DIR/inbe.tar.gz"
echo "✓ Published to https://inbe.waozi.xyz"
+13 -34
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copy assets to Android project without requiring nix-shell or Makefile dependencies
# Generate embedded assets for Android without requiring nix-shell.
# This script is used by GitHub Actions and F-Droid builds
# This script works from any directory by detecting the repository root
@@ -13,42 +13,15 @@ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$REPO_ROOT" || exit 1
echo "Running from repository root: $(pwd)"
echo "Copying assets to Android project..."
echo "Generating embedded assets for Android..."
ANDROID_DIR="droid"
ASSETS_DIR="$ANDROID_DIR/app/src/main/assets"
echo "Copying assets to Android project..."
# Remove and recreate assets directory
# Keep APK assets empty; runtime assets are compiled into the native library.
rm -rf "$ASSETS_DIR"
mkdir -p "$ASSETS_DIR"
# Copy config files
echo "Copying config files..."
cp inbe.ini "$ASSETS_DIR/inbe.ini"
cp theme.ini "$ASSETS_DIR/theme.ini"
# Copy locales
echo "Copying locales..."
mkdir -p "$ASSETS_DIR/locales"
cp locales/*.txt "$ASSETS_DIR/locales/"
# Copy themes
echo "Copying themes..."
mkdir -p "$ASSETS_DIR/themes"
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..."
mkdir -p "$ASSETS_DIR/assets"
cp assets/angel.jpg assets/begin.jpg "$ASSETS_DIR/assets/"
# Copy sounds
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
@@ -60,8 +33,14 @@ 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/"
mkdir -p build
sh vendor/flint/scripts/embed-assets.sh build/inbe_embedded_assets.c \
locales/*.txt \
vendor/flint/themes/*.ini \
assets/angel.jpg \
assets/begin.jpg \
assets/fonts/locales.png \
assets/fonts/locales.dat \
assets/sounds/*.ogg
echo "Assets copied successfully!"
echo "Embedded assets generated successfully!"
-64
View File
@@ -1,64 +0,0 @@
#!/usr/bin/env bash
set -e
APK_PATH="build/android/app-universal-debug.apk"
PACKAGE_NAME="xyz.waozi.inbe"
echo "🚀 Android App Builder & Installer"
echo " This script builds the APK and installs it to your chosen device"
echo ""
# Build APK
echo "🔨 Building APK..."
make android-debug
echo "✅ APK built: $APK_PATH"
echo ""
# Get list of connected devices
mapfile -t DEVICES < <(adb devices | grep -v "List" | grep -v "^$" | awk '{print $1}')
if [ ${#DEVICES[@]} -eq 0 ]; then
echo "❌ No Android devices found"
echo " Connect a device or start an emulator:"
echo " ./scripts/emulator.sh"
exit 1
fi
echo "📱 Found ${#DEVICES[@]} device(s):"
for i in "${!DEVICES[@]}"; do
DEVICE_ID="${DEVICES[$i]}"
# Get device info
DEVICE_NAME=$(adb -s "$DEVICE_ID" shell getprop ro.product.model 2>/dev/null | tr -d '\r')
DEVICE_ANDROID=$(adb -s "$DEVICE_ID" shell getprop ro.build.version.release 2>/dev/null | tr -d '\r')
echo " [$i] $DEVICE_ID"
echo " Model: $DEVICE_NAME"
echo " Android: $DEVICE_ANDROID"
echo ""
done
# Select device
if [ ${#DEVICES[@]} -eq 1 ]; then
SELECTED_DEVICE="${DEVICES[0]}"
echo "✅ Using only available device"
else
echo -n "👉 Select device number [0-$((${#DEVICES[@]}-1))]: "
read -r SELECTION
SELECTED_DEVICE="${DEVICES[$SELECTION]}"
fi
echo ""
echo "📦 Installing APK to $SELECTED_DEVICE..."
adb -s "$SELECTED_DEVICE" install -r "$APK_PATH"
echo "🚀 Launching app..."
adb -s "$SELECTED_DEVICE" shell am start -n "$PACKAGE_NAME/.MainActivity"
echo ""
echo "🎉 App is running!"
echo ""
echo "To rebuild and reinstall:"
echo " ./scripts/run-android.sh"
echo ""
echo "To view logs:"
echo " adb -s $SELECTED_DEVICE logcat | grep inbe"
-15
View File
@@ -1,15 +0,0 @@
speed 8
max_rounds 4
max_breaths 30
pause_seconds 2
sound_volume 100
tutorial_seen 1
theme 4
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
+35 -39
View File
@@ -35,22 +35,6 @@ static void android_wakelock_set_activity_impl(JNIEnv *env, jobject thiz) {
android_wakelock_set_activity(env, thiz);
}
// Called from Java when activity is paused
static void android_timer_activate_impl(JNIEnv *env, jobject thiz) {
(void)env;
(void)thiz;
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "JNI: Timer ACTIVATE callback");
android_timer_activate();
}
// Called from Java when activity is resumed
static void android_timer_deactivate_impl(JNIEnv *env, jobject thiz) {
(void)env;
(void)thiz;
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "JNI: Timer DEACTIVATE callback");
android_timer_deactivate();
}
static JavaVM *g_jvm = NULL;
static jobject g_activity = NULL;
@@ -105,9 +89,32 @@ static jint nativeGetPlayInBackground(JNIEnv *env, jobject thiz)
return 0; // Default to disabled
}
// JNI function - Auto-pause session when app goes to background
static void nativePauseSession(JNIEnv *env, jobject thiz)
static void nativeSetBackgroundActive(JNIEnv *env, jobject thiz, jboolean active)
{
(void)env;
(void)thiz;
void *app = get_global_inbe_app();
InbeApp *inbe_app = (InbeApp*)app;
if (inbe_app != NULL) {
inbe_app->backgrounded = active ? 1 : 0;
}
if (active) {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeSetBackgroundActive: activating background timer");
android_timer_activate();
} else {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeSetBackgroundActive: deactivating background timer");
android_timer_deactivate();
}
}
// JNI function - Auto-pause session when app goes to background
static jint nativePauseSession(JNIEnv *env, jobject thiz)
{
(void)env;
(void)thiz;
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativePauseSession: called");
void *app = get_global_inbe_app();
char msg[128];
@@ -120,27 +127,25 @@ static void nativePauseSession(JNIEnv *env, jobject thiz)
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", msg);
if (!inbe_app->session_paused) {
inbe_app->session_paused = 1;
inbe_app->backgrounded = 1;
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativePauseSession: set session_paused = 1");
#ifdef __ANDROID__
if (inbe_app->inbe.play_in_background) {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativePauseSession: Releasing wake lock and stopping timer");
android_wakelock_release();
android_timer_stop();
} else {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativePauseSession: SKIPPING wake lock/timer (play_in_background disabled)");
}
#endif
return 1;
} else {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativePauseSession: Session already paused, skipping");
}
} else {
__android_log_write(ANDROID_LOG_ERROR, "INBE_JNI", "nativePauseSession: app is NULL!");
}
return 0;
}
// JNI function - Auto-resume session when app returns to foreground
static void nativeResumeSession(JNIEnv *env, jobject thiz)
{
(void)env;
(void)thiz;
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeResumeSession: called");
void *app = get_global_inbe_app();
char msg[128];
@@ -153,16 +158,8 @@ static void nativeResumeSession(JNIEnv *env, jobject thiz)
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", msg);
if (inbe_app->session_paused) {
inbe_app->session_paused = 0;
inbe_app->backgrounded = 0;
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeResumeSession: set session_paused = 0");
#ifdef __ANDROID__
if (inbe_app->inbe.play_in_background) {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeResumeSession: Acquiring wake lock and starting timer");
android_wakelock_acquire();
android_timer_start();
} else {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeResumeSession: SKIPPING wake lock/timer (play_in_background disabled)");
}
#endif
} else {
__android_log_write(ANDROID_LOG_INFO, "INBE_JNI", "nativeResumeSession: Session not paused, skipping");
}
@@ -175,10 +172,9 @@ static void nativeResumeSession(JNIEnv *env, jobject thiz)
static const JNINativeMethod g_methods[] = {
{"nativeSetInsets", "(IIIIII)V", (void*)nativeSetInsets},
{"nativeWakeLockReady", "()V", (void*)android_wakelock_set_activity_impl},
{"nativeTimerActivate", "()V", (void*)android_timer_activate_impl},
{"nativeTimerDeactivate", "()V", (void*)android_timer_deactivate_impl},
{"nativeSetBackgroundActive", "(Z)V", (void*)nativeSetBackgroundActive},
{"nativeGetPlayInBackground", "()I", (void*)nativeGetPlayInBackground},
{"nativePauseSession", "()V", (void*)nativePauseSession},
{"nativePauseSession", "()I", (void*)nativePauseSession},
{"nativeResumeSession", "()V", (void*)nativeResumeSession},
{"nativeImportSelectedFile", "(Ljava/lang/String;)V", (void*)android_import_native_selected},
{"nativeImportCancelled", "()V", (void*)android_import_native_cancelled},
+68 -180
View File
@@ -13,8 +13,9 @@
#endif
#include "version.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#include "flint_dpi.h"
#include "flint_text.h"
#include "flint_embedded_assets.h"
#if !defined(LOTUS_BUILD)
#define RINI_IMPLEMENTATION
@@ -44,11 +45,11 @@ void set_global_inbe_app(InbeApp *app);
#define INBE_DEFAULT_HEIGHT 560
InbeConfig config = {
.title = "",
.title = "Inner Breeze",
.width = INBE_DEFAULT_WIDTH,
.height = INBE_DEFAULT_HEIGHT,
.loaded = 0,
.title_custom = 0
.title_custom = 1
};
int view_width = INBE_DEFAULT_WIDTH;
@@ -120,106 +121,24 @@ static UITab g_tabs[] = {
static UITabBar g_tab_bar = {g_tabs, 3};
typedef struct ChoppedGlyph {
int32_t value;
int32_t x;
int32_t y;
int32_t w;
int32_t h;
int32_t offsetX;
int32_t offsetY;
int32_t advanceX;
} ChoppedGlyph;
static Font
load_chopped_font(const char *png_path, const char *dat_path)
{
Font font = {0};
FILE *file = NULL;
ChoppedGlyph *glyphs = NULL;
GlyphInfo *glyph_infos = NULL;
Rectangle *recs = NULL;
int32_t glyph_count = 0;
Image image = {0};
Texture2D texture = {0};
file = fopen(dat_path, "rb");
if(file == NULL)
return font;
if(fread(&glyph_count, sizeof(glyph_count), 1, file) != 1 || glyph_count <= 0) {
fclose(file);
return font;
}
glyphs = calloc((size_t)glyph_count, sizeof(*glyphs));
glyph_infos = calloc((size_t)glyph_count, sizeof(*glyph_infos));
recs = calloc((size_t)glyph_count, sizeof(*recs));
if(glyphs == NULL || glyph_infos == NULL || recs == NULL)
goto cleanup;
if(fread(glyphs, sizeof(*glyphs), (size_t)glyph_count, file) != (size_t)glyph_count)
goto cleanup;
fclose(file);
file = NULL;
image = LoadImage(png_path);
if(image.data == NULL)
goto cleanup;
texture = LoadTextureFromImage(image);
UnloadImage(image);
image = (Image){0};
if(texture.id == 0)
goto cleanup;
SetTextureFilter(texture, TEXTURE_FILTER_POINT);
for(int i = 0; i < glyph_count; i++) {
glyph_infos[i].value = glyphs[i].value;
glyph_infos[i].offsetX = glyphs[i].offsetX;
glyph_infos[i].offsetY = glyphs[i].offsetY;
glyph_infos[i].advanceX = glyphs[i].advanceX;
glyph_infos[i].image = (Image){0};
recs[i].x = (float)glyphs[i].x;
recs[i].y = (float)glyphs[i].y;
recs[i].width = (float)glyphs[i].w;
recs[i].height = (float)glyphs[i].h;
}
font.texture = texture;
font.glyphs = glyph_infos;
font.recs = recs;
font.glyphCount = glyph_count;
font.baseSize = LOCALE_FONT_BASE_SIZE;
font.glyphPadding = 0;
free(glyphs);
return font;
cleanup:
if(file != NULL)
fclose(file);
if(image.data != NULL)
UnloadImage(image);
if(texture.id != 0)
UnloadTexture(texture);
free(glyphs);
free(glyph_infos);
free(recs);
return (Font){0};
}
static int
load_locale_font(InbeApp *app)
{
Font font;
Image white;
const FlintEmbeddedAsset *png;
const FlintEmbeddedAsset *dat;
if(app == NULL)
return 0;
font = load_chopped_font(LOCALE_FONT_PNG, LOCALE_FONT_DAT);
png = flint_embedded_asset(LOCALE_FONT_PNG);
dat = flint_embedded_asset(LOCALE_FONT_DAT);
if(png == NULL || dat == NULL)
return 0;
font = flint_text_load_chopped_font_from_memory(png->data, png->size, dat->data, dat->size,
LOCALE_FONT_BASE_SIZE);
if(font.texture.id == 0)
return 0;
@@ -227,9 +146,7 @@ load_locale_font(InbeApp *app)
app->font_shapes_texture = LoadTextureFromImage(white);
UnloadImage(white);
if(app->font_shapes_texture.id == 0) {
UnloadTexture(font.texture);
free(font.glyphs);
free(font.recs);
flint_text_unload_font(&font);
return 0;
}
SetTextureFilter(app->font_shapes_texture, TEXTURE_FILTER_POINT);
@@ -248,11 +165,7 @@ unload_locale_font(InbeApp *app)
return;
flint_text_set_font((Font){0});
if(app->locale_font.texture.id != 0)
UnloadTexture(app->locale_font.texture);
free(app->locale_font.glyphs);
free(app->locale_font.recs);
app->locale_font = (Font){0};
flint_text_unload_font(&app->locale_font);
}
static void
@@ -402,24 +315,13 @@ refresh_theme_colors(int theme_id, int dark_mode)
static void
inbe_settings_path(char *out, size_t out_size)
{
char apps_path[FS_PATH_MAX];
char inbe_path[FS_PATH_MAX];
snprintf(apps_path, sizeof(apps_path), "%s/apps", data_root());
if(!DirectoryExists(apps_path))
MakeDirectory(apps_path);
snprintf(inbe_path, sizeof(inbe_path), "%s/apps/inbe", data_root());
if(!DirectoryExists(inbe_path))
MakeDirectory(inbe_path);
snprintf(out, out_size, "%s/apps/inbe/settings.ini", data_root());
snprintf(out, out_size, "%s/settings.ini", data_root());
}
static void
register_all_themes(void)
{
if(DirectoryExists("vendor/flint/themes"))
flint_theme_register_defaults("vendor/flint/themes");
else
flint_theme_register_defaults("themes");
flint_theme_register_defaults("vendor/flint/themes");
}
static void
@@ -428,34 +330,6 @@ load_config(void)
if(config.loaded)
return;
const char *paths[] = {
"inbe.ini",
"apps/inbe/inbe.ini",
"../inbe/inbe.ini",
0
};
for(int i = 0; paths[i] != 0; i++) {
rini_data ini = rini_load(paths[i]);
if(ini.count == 0) {
rini_unload(&ini);
continue;
}
const char *title = rini_get_value_text(ini, "title");
if(title != NULL && title[0] != '\0') {
snprintf(config.title, sizeof(config.title), "%s", title);
config.title_custom = 1;
} else {
snprintf(config.title, sizeof(config.title), "%s", locale_get("app_title"));
config.title_custom = 0;
}
config.width = rini_get_value_fallback(ini, "width", INBE_DEFAULT_WIDTH);
config.height = rini_get_value_fallback(ini, "height", INBE_DEFAULT_HEIGHT);
rini_unload(&ini);
break;
}
if(config.title[0] == '\0') {
snprintf(config.title, sizeof(config.title), "%s", locale_get("app_title"));
config.title_custom = 0;
@@ -588,8 +462,9 @@ load_settings(InbeApp *app)
char settings_path[FS_PATH_MAX];
inbe_settings_path(settings_path, sizeof(settings_path));
rini_data settings = rini_load(settings_path);
int settings_missing = settings.count == 0;
int speed = rini_get_value_fallback(settings, "speed", 8);
int speed = rini_get_value_fallback(settings, "speed", DefaultSpeedLevel);
int max_rounds = rini_get_value_fallback(settings, "max_rounds", DefaultMaxRounds);
int max_breaths = rini_get_value_fallback(settings, "max_breaths", DefaultMaxBreaths);
int pause_seconds = rini_get_value_fallback(settings, "pause_seconds", DefaultPauseSeconds);
@@ -606,7 +481,7 @@ load_settings(InbeApp *app)
#endif
app->sound_volume = clampi(sound_volume, SETTINGS_VOLUME_MIN, SETTINGS_VOLUME_MAX);
app->inbe.progressive_speed = rini_get_value_fallback(settings, "progressive_speed", 1) != 0;
app->inbe.progressive_start_speed = clampi(rini_get_value_fallback(settings, "progressive_start_speed", 3),
app->inbe.progressive_start_speed = clampi(rini_get_value_fallback(settings, "progressive_start_speed", DefaultProgressiveStartSpeed),
SETTINGS_SPEED_MIN, SETTINGS_SPEED_MAX);
app->advanced_session_controls = rini_get_value_fallback(settings, "advanced_session_controls", 0) != 0;
app->hold_display_mode = clampi(rini_get_value_fallback(settings, "hold_display_mode", HOLD_DISPLAY_CIRCLE),
@@ -649,12 +524,39 @@ load_settings(InbeApp *app)
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
refresh_locale_dependent_text(app);
rini_unload(&settings);
if(settings_missing)
save_settings(app);
}
static Texture2D
load_pixel_texture(const char *path)
load_pixel_texture_from_asset(const char *path)
{
Texture2D texture = LoadTexture(path);
const FlintEmbeddedAsset *asset = flint_embedded_asset(path);
Image image;
Texture2D texture = {0};
if(asset == NULL || asset->data == NULL || asset->size == 0)
return texture;
image = LoadImageFromMemory(flint_embedded_asset_extension(path), asset->data, (int)asset->size);
if(image.data == NULL)
return texture;
#if defined(_WIN32)
{
int pot_w = 1;
int pot_h = 1;
while(pot_w < image.width)
pot_w <<= 1;
while(pot_h < image.height)
pot_h <<= 1;
if(pot_w != image.width || pot_h != image.height)
ImageResizeCanvas(&image, pot_w, pot_h, 0, 0, BLANK);
}
#endif
texture = LoadTextureFromImage(image);
UnloadImage(image);
if(texture.id != 0)
SetTextureFilter(texture, TEXTURE_FILTER_POINT);
return texture;
@@ -680,40 +582,29 @@ load_asset_texture(const char *name)
char path[64];
snprintf(path, sizeof(path), "assets/%s", name);
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID) || defined(PLATFORM_WEB)
return load_pixel_texture(path);
#else
if(FileExists(path))
return load_pixel_texture(path);
snprintf(path, sizeof(path), "../inbe/assets/%s", name);
if(FileExists(path))
return load_pixel_texture(path);
snprintf(path, sizeof(path), "../assets/%s", name);
return load_pixel_texture(path);
#endif
return load_pixel_texture_from_asset(path);
}
static Sound
load_sound_asset(const char *name)
{
char path[96];
const FlintEmbeddedAsset *asset;
Wave wave;
Sound sound = {0};
snprintf(path, sizeof(path), "assets/sounds/%s", name);
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID) || defined(PLATFORM_WEB)
return LoadSound(path);
#else
if(FileExists(path))
return LoadSound(path);
asset = flint_embedded_asset(path);
if(asset == NULL || asset->data == NULL || asset->size == 0)
return sound;
snprintf(path, sizeof(path), "../inbe/assets/sounds/%s", name);
if(FileExists(path))
return LoadSound(path);
wave = LoadWaveFromMemory(flint_embedded_asset_extension(path), asset->data, (int)asset->size);
if(wave.data == NULL)
return sound;
snprintf(path, sizeof(path), "../assets/sounds/%s", name);
return LoadSound(path);
#endif
sound = LoadSoundFromWave(wave);
UnloadWave(wave);
return sound;
}
static void
@@ -794,7 +685,6 @@ inbe_app_init(void *vapp) {
app->manual_drag_content = 0;
app->manual_drag_content_y = 0;
app->tutorial_step = 0;
app->tutorial_layouts_initialized = 0;
history_tab_reset(app);
app->session_paused = 0;
app->backgrounded = 0;
@@ -802,6 +692,8 @@ inbe_app_init(void *vapp) {
app->results_path[0] = '\0';
update_session_sounds(app);
reset_settings_preview(app);
inbeinit(&app->start_speed_preview);
app->start_speed_preview_speed = 0;
if(app->gear_icon.id == 0) {
app->gear_icon = load_icon_texture("gear.png");
@@ -859,6 +751,9 @@ inbe_app_init(void *vapp) {
if(app->globe_icon.id == 0) {
app->globe_icon = load_icon_texture("globe.png");
}
if(app->btc_icon.id == 0) {
app->btc_icon = load_icon_texture("btc.png");
}
if(app->monero_icon.id == 0) {
app->monero_icon = load_icon_texture("monero.png");
}
@@ -1136,6 +1031,7 @@ inbe_app_destroy(void *vapp)
SafeUnloadTexture(app->save_icon);
SafeUnloadTexture(app->discord_icon);
SafeUnloadTexture(app->telegram_icon);
SafeUnloadTexture(app->btc_icon);
SafeUnloadTexture(app->monero_icon);
SafeUnloadTexture(app->sound0_icon);
SafeUnloadTexture(app->sound1_icon);
@@ -1146,14 +1042,6 @@ inbe_app_destroy(void *vapp)
SafeUnloadTexture(app->font_shapes_texture);
unload_locale_font(app);
/* Cleanup tutorial text layouts */
if(app->tutorial_layouts_initialized) {
for(int i = 0; i < 5; i++) {
flint_text_layout_free(app->tutorial_layouts[i]);
free(app->tutorial_layouts[i]);
}
}
SafeUnloadSound(app->breath_in_sound);
SafeUnloadSound(app->breath_out_sound);
SafeUnloadSound(app->bell_sound);
+5 -4
View File
@@ -3,7 +3,6 @@
#include "raylib.h"
#include "../libinbe/inbe.h"
#include "flint_text_layout.h"
#include "app_fwd.h"
enum {
@@ -78,6 +77,7 @@ typedef enum {
UIModalConfirmExitSession,
UIModalConfirmDeleteData,
UIModalConfirmDeleteHistory,
UIModalEditProgressiveStartSpeed,
} UIModalType;
typedef struct {
@@ -113,6 +113,8 @@ typedef enum HoldDisplayMode {
struct InbeApp {
Inbe inbe;
Inbe settings_preview;
Inbe start_speed_preview;
int start_speed_preview_speed;
Camera2D camera;
int cursor_clickable;
Texture2D gear_icon;
@@ -131,6 +133,7 @@ struct InbeApp {
Texture2D discord_icon;
Texture2D telegram_icon;
Texture2D globe_icon;
Texture2D btc_icon;
Texture2D monero_icon;
Texture2D sound0_icon;
Texture2D sound1_icon;
@@ -174,9 +177,6 @@ struct InbeApp {
int tutorial_step;
int tutorial_seen;
FlintTextLayout *tutorial_layouts[6];
int tutorial_layouts_initialized;
int theme_id;
int dark_mode;
#if defined(LOTUS_BUILD)
@@ -228,5 +228,6 @@ 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);
void settings_draw_progressive_start_speed_editor(InbeApp *app);
#endif
+16 -6
View File
@@ -309,25 +309,35 @@ data_root(void)
return g_data_root;
#if defined(PLATFORM_WEB)
snprintf(g_data_root, sizeof(g_data_root), "/home/lotus");
snprintf(g_data_root, sizeof(g_data_root), "/home/inbe");
EM_ASM({
try {
FS.mkdir('/home');
FS.mkdir('/home/lotus');
FS.mkdir('/home/inbe');
} catch(e) {}
});
#elif defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
snprintf(g_data_root, sizeof(g_data_root), "/data/data/xyz.waozi.inbe/files/lotus");
snprintf(g_data_root, sizeof(g_data_root), "%s/inbe", GetWorkingDirectory());
#elif defined(_WIN32)
const char *local = getenv("LOCALAPPDATA");
const char *roaming = getenv("APPDATA");
if(local != NULL && local[0] != '\0')
snprintf(g_data_root, sizeof(g_data_root), "%s/Inbe", local);
else if(roaming != NULL && roaming[0] != '\0')
snprintf(g_data_root, sizeof(g_data_root), "%s/Inbe", roaming);
else
snprintf(g_data_root, sizeof(g_data_root), "Inbe");
#else
const char *xdg = getenv("XDG_DATA_HOME");
const char *home = getenv("HOME");
if(xdg != NULL && xdg[0] != '\0')
snprintf(g_data_root, sizeof(g_data_root), "%s/lotus", xdg);
snprintf(g_data_root, sizeof(g_data_root), "%s/inbe", xdg);
else if(home != NULL && home[0] != '\0')
snprintf(g_data_root, sizeof(g_data_root), "%s/.local/share/lotus", home);
snprintf(g_data_root, sizeof(g_data_root), "%s/.local/share/inbe", home);
else
snprintf(g_data_root, sizeof(g_data_root), ".local/lotus");
snprintf(g_data_root, sizeof(g_data_root), ".local/inbe");
#endif
ensure_dir(g_data_root);
+147 -21
View File
@@ -1,9 +1,18 @@
#include "raylib.h"
#include "app.h"
#include "flint_dpi.h"
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#if defined(_WIN32) && !defined(__ANDROID__)
__declspec(dllimport) int __stdcall MessageBoxA(void *hwnd, const char *text,
const char *caption, unsigned int type);
#define MB_OK 0x00000000u
#define MB_ICONERROR 0x00000010u
#define WIN_ERROR_LOG_CAP 2048
#endif
#if defined(PLATFORM_ANDROID) || defined(__ANDROID__) || defined(ANDROID)
#include "android_insets.h"
#include "android_wakelock.h"
@@ -20,6 +29,127 @@ extern struct android_app *GetAndroidApp(void);
static InbeApp inbe_app;
static InbeApp *g_inbe_app_ptr = NULL; // Global pointer for JNI access
#if defined(_WIN32) && !defined(__ANDROID__)
static FILE *win_log_file;
static char win_recent_errors[WIN_ERROR_LOG_CAP];
static int win_recent_errors_len;
static int
windows_text_contains(const char *text, const char *needle)
{
if(text == NULL || needle == NULL || needle[0] == '\0')
return 0;
for(const char *p = text; *p != '\0'; p++) {
const char *a = p;
const char *b = needle;
while(*a != '\0' && *b != '\0' && *a == *b) {
a++;
b++;
}
if(*b == '\0')
return 1;
}
return 0;
}
static void
windows_remember_error(const char *level, const char *message)
{
if(message == NULL || message[0] == '\0')
return;
int written = snprintf(win_recent_errors + win_recent_errors_len,
sizeof(win_recent_errors) - (size_t)win_recent_errors_len,
"[%s] %s\n",
level,
message);
if(written <= 0)
return;
if((size_t)written >= sizeof(win_recent_errors) - (size_t)win_recent_errors_len) {
win_recent_errors_len = (int)sizeof(win_recent_errors) - 1;
return;
}
win_recent_errors_len += written;
}
static void
windows_trace_log(int log_level, const char *text, va_list args)
{
const char *level = "INFO";
char message[1024];
va_list message_args;
va_copy(message_args, args);
vsnprintf(message, sizeof(message), text, message_args);
va_end(message_args);
switch(log_level) {
case LOG_TRACE: level = "TRACE"; break;
case LOG_DEBUG: level = "DEBUG"; break;
case LOG_INFO: level = "INFO"; break;
case LOG_WARNING: level = "WARNING"; break;
case LOG_ERROR: level = "ERROR"; break;
case LOG_FATAL: level = "FATAL"; break;
default: break;
}
if(log_level >= LOG_WARNING)
windows_remember_error(level, message);
if(win_log_file != NULL) {
fprintf(win_log_file, "[%s] %s\n", level, message);
fflush(win_log_file);
}
}
static void
windows_show_startup_error(void)
{
char dialog[3072];
const char *detail = win_recent_errors[0] != '\0' ?
win_recent_errors :
"No detailed startup error was reported.";
const char *hint = "";
if(windows_text_contains(detail, "OpenGL") ||
windows_text_contains(detail, "WGL") ||
windows_text_contains(detail, "GLFW")) {
hint = "\nThis is usually a graphics driver or virtual GPU problem. "
"Update the GPU driver, enable VM 3D acceleration, or install the VM guest graphics driver.\n";
}
snprintf(dialog,
sizeof(dialog),
"Inner Breeze could not create a window.\n\n%s%s\nA full log was written to inbe.log next to the executable.",
detail,
hint);
MessageBoxA(NULL, dialog, "Inner Breeze", MB_OK | MB_ICONERROR);
}
static void
windows_install_logger(void)
{
win_log_file = fopen("inbe.log", "ab");
if(win_log_file != NULL)
SetTraceLogCallback(windows_trace_log);
}
static void
windows_close_logger(void)
{
if(win_log_file != NULL) {
fclose(win_log_file);
win_log_file = NULL;
}
}
#endif
InbeApp* get_global_inbe_app(void) {
if (g_inbe_app_ptr == NULL) {
TraceLog(LOG_WARNING, "WARNING: get_global_inbe_app called with NULL pointer");
@@ -50,22 +180,6 @@ android_clamp_content_size(int size, int leading_inset, int trailing_inset)
}
#endif
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(PLATFORM_WEB)
static void
use_packaged_app_directory(void)
{
char probe_path[512];
const char *app_dir = GetApplicationDirectory();
if(app_dir == NULL || app_dir[0] == '\0')
return;
snprintf(probe_path, sizeof(probe_path), "%sassets/sounds/bell.ogg", app_dir);
if(FileExists(probe_path))
ChangeDirectory(app_dir);
}
#endif
static void
frame(void)
{
@@ -91,8 +205,8 @@ frame(void)
int safe_left = insets.cutout_left;
int safe_right = insets.cutout_right;
int content_x = 0;
int content_y = 0;
int content_x = safe_left;
int content_y = safe_top;
int content_width = android_clamp_content_size(width, safe_left, safe_right);
int content_height = android_clamp_content_size(height, safe_top, safe_bottom);
@@ -134,11 +248,12 @@ int main(int argc, char **argv) {
#endif
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(PLATFORM_WEB)
use_packaged_app_directory();
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
#endif
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(PLATFORM_WEB)
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
#if defined(_WIN32) && !defined(__ANDROID__)
windows_install_logger();
TraceLog(LOG_INFO, "INBE: Windows startup");
#endif
#if INBE_ANDROID_BUILD
@@ -155,6 +270,14 @@ int main(int argc, char **argv) {
InitWindow(window_w, window_h, config.title);
if(!IsWindowReady()) {
TraceLog(LOG_ERROR, "INBE: InitWindow failed");
#if defined(_WIN32) && !defined(__ANDROID__)
windows_show_startup_error();
windows_close_logger();
#endif
return 1;
}
flint_dpi_init();
inbe_app_init(&inbe_app);
@@ -177,6 +300,9 @@ int main(int argc, char **argv) {
}
CloseWindow();
#if defined(_WIN32) && !defined(__ANDROID__)
windows_close_logger();
#endif
#endif
return 0;
}
+116 -25
View File
@@ -3,7 +3,6 @@
#include "data.h"
#include "locale.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#include "raylib.h"
#include <dirent.h>
@@ -290,7 +289,9 @@ draw_history_row(InbeApp *app, int x, int y, int w, int h, const char *text, int
ui_draw_bevel(x, y, w, h, flint_lighten(c_button, 28), flint_darken(c_button, 20));
}
flint_text_draw(text, x + flint_px(indent), y + flint_px(6), flint_px(16), c_text);
flint_text_draw(text, x + flint_px(indent),
flint_ui_text_y(text, y, h, flint_px(16)),
flint_px(16), c_text);
return hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
}
@@ -317,7 +318,8 @@ draw_history_session_row(InbeApp *app, int x, int y, int w, int h, const char *t
ui_draw_bevel(x, y, w, h, flint_lighten(c_button, 28), flint_darken(c_button, 20));
}
flint_text_draw(text, x + flint_px(46), y + flint_px(6), font, c_text);
flint_text_draw(text, x + flint_px(46),
flint_ui_text_y(text, y, h, font), font, c_text);
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
return 1;
@@ -712,7 +714,8 @@ history_keyboard_key(InbeApp *app, int x, int y, int w, int h, const char *label
}
text_w = flint_text_measure(label, font);
flint_text_draw(label, x + (w - text_w) / 2, y + (h - font) / 2 - 1, font, c_text);
flint_text_draw(label, x + (w - text_w) / 2,
flint_ui_text_y(label, y, h, font), font, c_text);
return pressed;
}
@@ -827,14 +830,13 @@ 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)
history_draw_edit_field(InbeApp *app, const HistoryEntry *entry, int x, int y, int w, int h, int font)
{
int font = flint_px(16);
int valid = 0;
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 text_y = flint_ui_text_y(app->history_edit_text, y, h, font);
int caret_x;
history_update_edit_input(app, entry, x, field_y, w, field_h, text_x, font);
@@ -1075,6 +1077,83 @@ history_fit_session_label(const HistoryEntry *entry, int available_w, char *out,
snprintf(out, out_size, "%02d:%02d %ds", entry->hour, entry->minute, entry->avg_seconds);
}
static int
history_active_edit_row(const InbeApp *app, const HistoryEntry *entries, int count)
{
int row = 1;
if(app == NULL || entries == NULL || !app->history_edit_active ||
app->history_level != HISTORY_LEVEL_EDIT_DAY)
return -1;
for(int i = 0; i < count; i++) {
if(entries[i].year != app->history_year ||
entries[i].month != app->history_month ||
entries[i].day != app->history_day)
continue;
if(strcmp(app->history_edit_path, entries[i].path) == 0) {
if(app->history_edit_kind == HISTORY_EDIT_TIME)
return row;
if(app->history_edit_kind == HISTORY_EDIT_ROUND &&
app->history_edit_round >= 0 &&
app->history_edit_round < entries[i].round_count)
return row + 1 + app->history_edit_round;
}
row += 1 + entries[i].round_count;
}
return -1;
}
static void
history_scroll_edit_into_view(InbeApp *app, const HistoryEntry *entries, int count,
int row_h, int viewport_h, int max_scroll)
{
static char last_path[FS_PATH_MAX] = "";
static int last_kind = HISTORY_EDIT_NONE;
static int last_round = -1;
int row = history_active_edit_row(app, entries, count);
int margin = flint_px(10);
int row_top;
int row_bottom;
int changed;
if(app == NULL || !app->history_edit_active) {
last_path[0] = '\0';
last_kind = HISTORY_EDIT_NONE;
last_round = -1;
return;
}
if(row < 0 || max_scroll <= 0 || viewport_h <= 0)
return;
changed = last_kind != app->history_edit_kind ||
last_round != app->history_edit_round ||
strcmp(last_path, app->history_edit_path) != 0;
if(!changed)
return;
snprintf(last_path, sizeof(last_path), "%s", app->history_edit_path);
last_kind = app->history_edit_kind;
last_round = app->history_edit_round;
row_top = flint_px(12) + row * row_h;
row_bottom = row_top + row_h;
if(row_top - margin < app->history_scroll)
app->history_scroll = row_top - margin;
else if(row_bottom + margin > app->history_scroll + viewport_h)
app->history_scroll = row_bottom + margin - viewport_h;
if(app->history_scroll < 0)
app->history_scroll = 0;
if(app->history_scroll > max_scroll)
app->history_scroll = max_scroll;
}
void
history_tab_draw(InbeApp *app)
{
@@ -1097,6 +1176,8 @@ history_tab_draw(InbeApp *app)
int selected_index = -1;
int content_x;
int content_w;
int scrollbar_w = flint_px(8);
int scrollbar_gap = flint_px(6);
scan_history_tree(entries, &count);
qsort(entries, (size_t)count, sizeof(entries[0]), compare_history_entries);
@@ -1184,6 +1265,7 @@ history_tab_draw(InbeApp *app)
app->history_scroll -= (int)(GetMouseWheelMove() * 24.0f);
app->history_scroll = (app->history_scroll < 0) ? 0 : (app->history_scroll > max_scroll ? max_scroll : app->history_scroll);
history_scroll_edit_into_view(app, entries, count, row_h, viewport_h, max_scroll);
/* Use percentage of screen width like tutorial, not DPI-scaled CONTENT_MAX_W */
int responsive_max_w = (int)(view_width * 0.96f);
@@ -1192,6 +1274,8 @@ history_tab_draw(InbeApp *app)
responsive_max_w = min_content_w;
int side_padding = flint_page_side_padding();
flint_centered_column(responsive_max_w, side_padding, &content_x, &content_w);
if(max_scroll > 0 && content_w > flint_px(120) + scrollbar_w + scrollbar_gap)
content_w -= scrollbar_w + scrollbar_gap;
close_clicked = ui_draw_screen_header(locale_get("history_title"), 1);
if(close_clicked) {
@@ -1208,10 +1292,13 @@ history_tab_draw(InbeApp *app)
if(count == 0) {
int font = flint_px(16);
const char *empty_text = locale_get("history_empty");
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);
flint_ui_paragraph_draw((FlintUIParagraph){
.text = empty_text,
.width = content_w,
.font = font,
.line_gap = flint_px(22),
.color = c_text,
}, content_x, &y);
} else {
if(app->history_level == HISTORY_LEVEL_EDIT_DAY && has_day) {
int return_hover = 0;
@@ -1230,7 +1317,8 @@ history_tab_draw(InbeApp *app)
char label[HISTORY_TEXT_SIZE];
locale_format(label, sizeof(label), "history_day_label", app->history_day);
flint_text_draw(label, content_x + icon_size + icon_padding * 2 + flint_px(10),
y + flint_px(6), flint_px(14), c_text);
flint_ui_text_y(label, y, row_h, flint_px(16)),
flint_px(16), c_text);
}
y += row_h;
@@ -1248,8 +1336,8 @@ history_tab_draw(InbeApp *app)
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 + flint_px(8), y,
label_w, row_h);
history_draw_edit_field(app, &entries[i], content_x + flint_px(2), y,
label_w, row_h, flint_px(16));
if(!app->history_edit_active) {
app->history_scroll = 0;
EndScissorMode();
@@ -1264,8 +1352,9 @@ history_tab_draw(InbeApp *app)
}
}
} else {
flint_text_draw(time_label, content_x + flint_px(10), y + flint_px(6),
flint_px(14), c_text);
flint_text_draw(time_label, content_x + flint_px(10),
flint_ui_text_y(time_label, y, row_h, flint_px(16)),
flint_px(16), 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]);
@@ -1285,8 +1374,8 @@ history_tab_draw(InbeApp *app)
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 + flint_px(20), y,
label_w - flint_px(12), row_h);
history_draw_edit_field(app, &entries[i], content_x + flint_px(14), y,
label_w - flint_px(12), row_h, flint_px(16));
if(!app->history_edit_active) {
app->history_scroll = 0;
EndScissorMode();
@@ -1301,8 +1390,9 @@ history_tab_draw(InbeApp *app)
}
}
} else {
flint_text_draw(round_label, content_x + flint_px(22), y + flint_px(6),
flint_px(14), c_text);
flint_text_draw(round_label, content_x + flint_px(22),
flint_ui_text_y(round_label, y, row_h, flint_px(16)),
flint_px(16), 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);
@@ -1424,12 +1514,13 @@ history_tab_draw(InbeApp *app)
/* Draw scrollbar if needed */
if(max_scroll > 0) {
int scrollbar_w = flint_px(8);
int scrollbar_h = (viewport_h * viewport_h) / (content_h + viewport_h);
int scrollbar_x = content_x + content_w + flint_px(10);
int scrollbar_y = title_h + (app->history_scroll * (viewport_h - scrollbar_h)) / max_scroll;
int scrollbar_x = (int)(app->camera.offset.x + (content_x + content_w + scrollbar_gap) * app->camera.zoom);
int scrollbar_y = (int)(app->camera.offset.y + title_h * app->camera.zoom);
int scrollbar_viewport_h = (int)(viewport_h * app->camera.zoom);
int scrollbar_content_h = (int)(content_h * app->camera.zoom);
DrawRectangle(scrollbar_x, scrollbar_y, scrollbar_w, scrollbar_h, flint_darken(c_text, 40));
ui_draw_scrollbar(scrollbar_x, scrollbar_y, scrollbar_viewport_h,
scrollbar_content_h, &app->history_scroll, max_scroll);
}
if(history_should_show_keyboard(app) && keyboard_entry != NULL) {
+46 -87
View File
@@ -2,11 +2,9 @@
#include "app.h"
#include "locale.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#include "theme_meta.h"
#include "raylib.h"
#include <stdio.h>
#include <stdlib.h>
#define CONTENT_MAX_W 800 /* Responsive width for tutorial text reflow */
@@ -28,17 +26,6 @@ static const char *const TUTORIAL_KEYS[] = {
#define TUTORIAL_STEPS_COUNT (sizeof(TUTORIAL_KEYS) / sizeof(TUTORIAL_KEYS[0]))
#define TUTORIAL_LINE_SPACING flint_px(8) /* Normal readable line spacing */
/*
* Wrapper for compatibility - using Flint's unified button utility
* This function is deprecated - use ui_draw_generic_button() directly
*/
static int
draw_tutorial_footer_button(InbeApp *app, int x, int y, int w, int h, const char *label, int *hover)
{
(void)app;
return ui_draw_generic_button(x, y, w, h, label, UI_BUTTON_STYLE_PRIMARY, hover);
}
static void
draw_tutorial_hold_preview(InbeApp *app, int center_x, int center_y, int radius)
{
@@ -66,16 +53,32 @@ draw_tutorial_hold_preview(InbeApp *app, int center_x, int center_y, int radius)
flint_ui_draw_text_centered(text, center_x, center_y, font, c_text);
}
static void
init_tutorial_layouts(InbeApp *app, int body_font)
static FlintUIParagraph
tutorial_paragraph(InbeApp *app, int step, int content_w, int body_font)
{
if(!app->tutorial_layouts_initialized) {
for(int i = 0; i < (int)TUTORIAL_STEPS_COUNT; i++) {
app->tutorial_layouts[i] = calloc(1, sizeof(FlintTextLayout));
*app->tutorial_layouts[i] = flint_text_layout_parse(locale_get(TUTORIAL_KEYS[i]), (Texture2D){0}, FLINT_ICON_TYPE_NONE, body_font);
}
app->tutorial_layouts_initialized = 1;
}
int has_icon = step == 1;
return (FlintUIParagraph){
.text = locale_get(TUTORIAL_KEYS[step]),
.icon = has_icon ? app->gear_icon : (Texture2D){0},
.icon_type = has_icon ? FLINT_ICON_TYPE_GEAR : FLINT_ICON_TYPE_NONE,
.icon_size = has_icon ? flint_px(14) : 0,
.width = content_w,
.font = body_font,
.line_gap = TUTORIAL_LINE_SPACING,
.color = c_text,
};
}
static int
tutorial_paragraph_height(InbeApp *app, int step, int content_w, int body_font)
{
return flint_ui_paragraph_height(tutorial_paragraph(app, step, content_w, body_font));
}
static void
draw_tutorial_paragraph(InbeApp *app, int step, int content_x, int *y, int content_w, int body_font)
{
flint_ui_paragraph_draw(tutorial_paragraph(app, step, content_w, body_font), content_x, y);
}
void
@@ -84,14 +87,7 @@ manual_tab_reset_layouts(InbeApp *app)
if(app == NULL)
return;
for(int i = 0; i < (int)TUTORIAL_STEPS_COUNT; i++) {
if(app->tutorial_layouts[i] != NULL) {
flint_text_layout_free(app->tutorial_layouts[i]);
free(app->tutorial_layouts[i]);
app->tutorial_layouts[i] = NULL;
}
}
app->tutorial_layouts_initialized = 0;
app->manual_scroll = 0;
}
void
@@ -165,16 +161,6 @@ manual_tab_draw(InbeApp *app)
int side_padding = flint_page_side_padding();
flint_centered_column(responsive_max_w, side_padding, &content_x, &content_w);
/* Auto-reflow every frame */
if(!app->tutorial_layouts_initialized) {
init_tutorial_layouts(app, body_font);
}
/* Reflow all layouts for current container width */
for(int i = 0; i < (int)TUTORIAL_STEPS_COUNT; i++) {
flint_text_layout_reflow(app->tutorial_layouts[i], content_w, body_font, TUTORIAL_LINE_SPACING);
}
close_clicked = ui_draw_screen_header(title, 1);
if(close_clicked)
manual_tab_close_tutorial(app, 1);
@@ -183,19 +169,16 @@ manual_tab_draw(InbeApp *app)
/* Don't include padding in this calculation - it's handled separately */
int actual_content_h = 0; /* Content only, no padding */
if(step == 0) {
actual_content_h += flint_px(170) + flint_px(22) + flint_text_layout_get_height(app->tutorial_layouts[0]);
actual_content_h += flint_px(170) + flint_px(22) +
tutorial_paragraph_height(app, 0, content_w, body_font);
} else if(step == 1) {
/* Step 1 uses a fresh gear_layout for drawing - calculate height from it */
FlintTextLayout temp_gear = flint_text_layout_parse(locale_get(TUTORIAL_KEYS[1]), app->gear_icon, FLINT_ICON_TYPE_GEAR, flint_px(14));
flint_text_layout_reflow(&temp_gear, content_w, body_font, TUTORIAL_LINE_SPACING);
actual_content_h += flint_text_layout_get_height(&temp_gear);
flint_text_layout_free(&temp_gear);
actual_content_h += tutorial_paragraph_height(app, 1, content_w, body_font);
} else if(step == 2) {
actual_content_h += flint_text_layout_get_height(app->tutorial_layouts[2]) + flint_px(68);
actual_content_h += tutorial_paragraph_height(app, 2, content_w, body_font) + flint_px(68);
if(app->inbe.progressive_speed)
actual_content_h += flint_px(66);
} else if(step == 3) {
actual_content_h += flint_text_layout_get_height(app->tutorial_layouts[3]) + flint_px(20);
actual_content_h += tutorial_paragraph_height(app, 3, content_w, body_font) + flint_px(20);
/* Circle preview height - calculate actual rmax based on content_w */
/* update_preview_bounds uses min(content_w, 132)/2 clamped to 60-120 for rmax */
int preview_span = (content_w < flint_px(132)) ? content_w : flint_px(132);
@@ -211,9 +194,10 @@ manual_tab_draw(InbeApp *app)
int hold_preview_extent = hold_preview_radius + flint_px(8) + flint_px(5);
actual_content_h += flint_px(26) + flint_px(36) + flint_px(20);
actual_content_h += hold_preview_extent * 2 + flint_px(24);
actual_content_h += flint_text_layout_get_height(app->tutorial_layouts[4]);
actual_content_h += tutorial_paragraph_height(app, 4, content_w, body_font);
} else {
actual_content_h += flint_px(200) + flint_px(22) + flint_text_layout_get_height(app->tutorial_layouts[5]);
actual_content_h += flint_px(200) + flint_px(22) +
tutorial_paragraph_height(app, 5, content_w, body_font);
}
/* Calculate scroll range for virtual content space */
int top_padding = flint_px(16);
@@ -269,24 +253,14 @@ manual_tab_draw(InbeApp *app)
ui_draw_tutorial_image(app->angel_image, "angel.jpg", content_x, y, content_w, img_h);
y += img_h + flint_px(22);
if(app->tutorial_layouts_initialized && app->tutorial_layouts[0] != NULL) {
flint_text_layout_draw(app->tutorial_layouts[0], content_x, &y, body_font, c_text);
}
draw_tutorial_paragraph(app, 0, content_x, &y, content_w, body_font);
} else if(step == 1) {
/* Step 1 text with gear icon - parse fresh each frame for proper icon binding */
int icon_size = flint_px(14);
FlintTextLayout gear_layout = flint_text_layout_parse(locale_get(TUTORIAL_KEYS[1]), app->gear_icon, FLINT_ICON_TYPE_GEAR, icon_size);
flint_text_layout_reflow(&gear_layout, content_w, body_font, TUTORIAL_LINE_SPACING);
flint_text_layout_draw(&gear_layout, content_x, &y, body_font, c_text);
flint_text_layout_free(&gear_layout);
draw_tutorial_paragraph(app, 1, content_x, &y, content_w, body_font);
} else if(step == 2) {
if(app->tutorial_layouts_initialized && app->tutorial_layouts[2] != NULL) {
flint_text_layout_draw(app->tutorial_layouts[2], content_x, &y, body_font, c_text);
}
draw_tutorial_paragraph(app, 2, content_x, &y, content_w, body_font);
y += flint_px(18);
{
int progressive_speed = app->inbe.progressive_speed;
int progressive_start_speed = app->inbe.progressive_start_speed;
int toggle_w = flint_px(56);
int toggle_h = flint_px(30);
flint_text_draw(locale_get("progressive_speed_label"), content_x, y,
@@ -300,24 +274,10 @@ manual_tab_draw(InbeApp *app)
app->settings_dirty = 1;
}
y += toggle_h + flint_px(20);
if(app->inbe.progressive_speed) {
int max_speed = app->inbe.speed_level;
progressive_start_speed = clampi(progressive_start_speed, SETTINGS_SPEED_MIN, max_speed);
if(ui_draw_slider(11, content_x, y, content_w,
locale_get("progressive_start_speed_label"),
SETTINGS_SPEED_MIN, max_speed,
&progressive_start_speed, "")) {
app->inbe.progressive_start_speed = progressive_start_speed;
app->settings_preview.progressive_start_speed = progressive_start_speed;
app->settings_dirty = 1;
}
}
}
} else if(step == 3) {
int speed = app->inbe.speed_level;
if(app->tutorial_layouts_initialized && app->tutorial_layouts[3] != NULL) {
flint_text_layout_draw(app->tutorial_layouts[3], content_x, &y, body_font, c_text);
}
draw_tutorial_paragraph(app, 3, content_x, &y, content_w, body_font);
y += flint_px(20); /* Increased spacing between text and circle */
update_preview_bounds(&app->settings_preview, content_w, flint_px(132));
@@ -353,16 +313,12 @@ manual_tab_draw(InbeApp *app)
y += flint_px(36) + flint_px(20) + hold_preview_extent;
draw_tutorial_hold_preview(app, content_x + content_w / 2, y, hold_preview_radius);
y += hold_preview_extent + flint_px(24);
if(app->tutorial_layouts_initialized && app->tutorial_layouts[4] != NULL) {
flint_text_layout_draw(app->tutorial_layouts[4], content_x, &y, body_font, c_text);
}
draw_tutorial_paragraph(app, 4, content_x, &y, content_w, body_font);
} else {
int img_h = flint_px(200);
ui_draw_tutorial_image(app->begin_image, "begin.jpg", content_x, y, content_w, img_h);
y += img_h + flint_px(22);
if(app->tutorial_layouts_initialized && app->tutorial_layouts[5] != NULL) {
flint_text_layout_draw(app->tutorial_layouts[5], content_x, &y, body_font, c_text);
}
draw_tutorial_paragraph(app, 5, content_x, &y, content_w, body_font);
}
EndScissorMode();
@@ -397,16 +353,19 @@ manual_tab_draw(InbeApp *app)
footer_y - page_font - counter_gap, page_font, c_text);
if(step == 0) {
if(draw_tutorial_footer_button(app, content_x, footer_y, button_w, button_h, left_label, &left_hover))
if(ui_draw_generic_button(content_x, footer_y, button_w, button_h,
left_label, UI_BUTTON_STYLE_PRIMARY, &left_hover))
manual_tab_close_tutorial(app, 1);
} else {
if(draw_tutorial_footer_button(app, content_x, footer_y, button_w, button_h, left_label, &left_hover)) {
if(ui_draw_generic_button(content_x, footer_y, button_w, button_h,
left_label, UI_BUTTON_STYLE_PRIMARY, &left_hover)) {
app->tutorial_step--;
app->manual_scroll = 0;
}
}
if(draw_tutorial_footer_button(app, content_x + button_w + footer_gap, footer_y, button_w, button_h, right_label, &right_hover)) {
if(ui_draw_generic_button(content_x + button_w + footer_gap, footer_y, button_w, button_h,
right_label, UI_BUTTON_STYLE_PRIMARY, &right_hover)) {
if(step == (int)TUTORIAL_STEPS_COUNT - 1)
manual_tab_close_tutorial(app, 1);
else {
+143 -113
View File
@@ -1,9 +1,9 @@
#include "settings_tab.h"
#include "app.h"
#include "app_session.h"
#include "language_tab.h"
#include "locale.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#if !defined(PLATFORM_ANDROID) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(_WIN32) && !defined(PLATFORM_WEB)
#define INBE_HAS_FLINT_FILE_DIALOG 1
#include "flint_file_dialog.h"
@@ -84,11 +84,14 @@ draw_category_card(InbeApp *app, const char *title, const char *description,
int title_y = flint_ui_text_y(title, (int)rect.y + padding_y, title_font, title_font);
flint_text_draw(title, (int)rect.x + padding_x, title_y, title_font, c_text);
FlintTextLayout desc_layout = flint_text_layout_parse(description, (Texture2D){0}, FLINT_ICON_TYPE_NONE, desc_font);
flint_text_layout_reflow(&desc_layout, text_w, desc_font, flint_px(8));
int desc_y = title_y + title_font + flint_px(8);
flint_text_layout_draw(&desc_layout, (int)rect.x + padding_x, &desc_y, desc_font, flint_darken(c_text, 30));
flint_text_layout_free(&desc_layout);
flint_ui_paragraph_draw((FlintUIParagraph){
.text = description,
.width = text_w,
.font = desc_font,
.line_gap = flint_px(8),
.color = flint_darken(c_text, 30),
}, (int)rect.x + padding_x, &desc_y);
}
static void
@@ -180,84 +183,104 @@ settings_draw_subtab_bar(InbeApp *app, int x, int y, int w, int h,
return clicked_tab;
}
static void
settings_draw_exact_speed_preview(Inbe *preview, int *preview_speed,
int speed, int max_rounds, int max_breaths,
int pause_seconds, int content_w, int content_h,
int center_x, int center_y)
{
if(preview == NULL || preview_speed == NULL)
return;
if(preview->phase != InbePhaseBreathe) {
inbeinit(preview);
apply_settings(preview, speed, max_rounds, max_breaths, pause_seconds);
preview->progressive_speed = 0;
session_reset_round_breathe(preview);
} else if(*preview_speed != speed) {
apply_settings(preview, speed, max_rounds, max_breaths, pause_seconds);
preview->progressive_speed = 0;
}
if(*preview_speed != speed) {
*preview_speed = speed;
}
update_preview_bounds(preview, content_w, content_h);
inbestep(preview);
draw_preview_inbe(preview, center_x, center_y);
}
void
settings_draw_progressive_start_speed_editor(InbeApp *app)
{
int modal_w = flint_px(340);
int modal_h = flint_px(360);
if(modal_w > view_width - flint_px(24))
modal_w = view_width - flint_px(24);
if(modal_h > view_height - flint_px(24))
modal_h = view_height - flint_px(24);
int modal_x = (view_width - modal_w) / 2;
int modal_y = (view_height - modal_h) / 2;
int title_font = flint_ui_font();
int title_y = modal_y + flint_px(14);
int close_size = flint_px(22);
int close_padding = flint_px(8);
int close_w = close_size + close_padding * 2;
int close_hover = 0;
int max_speed = app->inbe.speed_level;
int start_speed = clampi(app->inbe.progressive_start_speed, SETTINGS_SPEED_MIN, max_speed);
DrawRectangle(0, 0, view_width, view_height, (Color){0, 0, 0, 180});
DrawRectangle(modal_x, modal_y, modal_w, modal_h, c_button);
ui_draw_bevel(modal_x, modal_y, modal_w, modal_h,
flint_lighten(c_button, 40), flint_darken(c_button, 40));
const char *title = locale_get("progressive_start_speed_editor_title");
int title_w = flint_text_measure(title, title_font);
int title_max_w = modal_w - close_w * 2 - flint_px(24);
while(title_font > flint_px(12) && title_w > title_max_w) {
title_font--;
title_w = flint_text_measure(title, title_font);
}
flint_text_draw(title, modal_x + (modal_w - title_w) / 2, title_y, title_font, c_text);
if(ui_draw_icon_btn_padded(modal_x + modal_w - close_w - flint_px(6), modal_y + flint_px(6),
close_size, close_padding, app->x_icon, UI_ICON_TYPE_X, &close_hover)) {
app->modal.active = 0;
app->modal.type = UIModalNone;
return;
}
settings_draw_exact_speed_preview(&app->start_speed_preview,
&app->start_speed_preview_speed,
start_speed,
app->inbe.max_rounds,
int_from_count(app->inbe.maxbreaths),
app->inbe.pause_seconds,
modal_w - flint_px(48),
flint_px(210),
modal_x + modal_w / 2,
modal_y + flint_px(150));
if(ui_draw_slider(12, modal_x + flint_px(24), modal_y + flint_px(250),
modal_w - flint_px(48), locale_get("progressive_start_speed_label"),
SETTINGS_SPEED_MIN, max_speed, &start_speed, "")) {
app->inbe.progressive_start_speed = start_speed;
app->settings_dirty = 1;
}
}
#if !defined(LOTUS_BUILD)
static void
draw_theme_selector(InbeApp *app, int x, int y, int w)
{
int font = flint_ui_font();
int small_font = flint_ui_font_small();
const char *label = locale_get("theme_label");
flint_text_draw(label, x, y, font, c_text);
/* Light/Dark toggle */
const char *theme_light_label = locale_get("theme_light");
const char *theme_dark_label = locale_get("theme_dark");
int theme_light_w = flint_text_measure(theme_light_label, font);
int theme_dark_w = flint_text_measure(theme_dark_label, font);
int max_label_w = (theme_light_w > theme_dark_w ? theme_light_w : theme_dark_w);
/* Calculate toggle width based on text measurements with padding */
int toggle_w = max_label_w * 2 + flint_px(32); /* Space for both labels + padding */
int min_toggle_w = flint_px(100); /* Minimum width */
if(toggle_w < min_toggle_w) toggle_w = min_toggle_w;
int toggle_h = flint_px(28);
int toggle_x = x + w - toggle_w - flint_px(8); /* Right-aligned with reduced margin */
int toggle_y = y - 2;
if(ui_draw_toggle_switch(toggle_x, toggle_y, toggle_w, toggle_h, &app->dark_mode,
theme_light_label, theme_dark_label)) {
if(ui_draw_theme_switcher(x, y, w, locale_get("theme_label"),
locale_get("theme_light"), locale_get("theme_dark"),
&app->theme_id, &app->dark_mode)) {
refresh_theme_colors(app->theme_id, app->dark_mode);
app->settings_dirty = 1;
}
int circle_size = flint_px(36);
int circle_spacing = flint_px(32);
int row_spacing = flint_px(48);
int per_row = 3;
int row_width = per_row * circle_size + (per_row - 1) * circle_spacing;
int start_x = x + (w - row_width) / 2;
int circle_y = y + flint_px(64);
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
for(int i = 0; i < THEME_COUNT; i++) {
int row = i / per_row;
int col = i % per_row;
int cx = start_x + col * (circle_size + circle_spacing) + circle_size / 2;
int cy = circle_y + row * (circle_size + row_spacing);
Color theme_color = c_circle;
if(!flint_theme_catalog_color((FlintThemeId)i, app->dark_mode != 0, "circle", &theme_color)) {
const char *scope = app->dark_mode ? g_themes[i].dark_scope : g_themes[i].light_scope;
theme_color = theme_get(scope, "circle");
}
DrawCircle(cx, cy, circle_size / 2, theme_color);
/* Draw selection ring */
if(app->theme_id == i) {
DrawCircleLines(cx, cy, circle_size / 2 + 2, c_text);
} else {
DrawCircleLines(cx, cy, circle_size / 2 + 1, flint_darken(c_bg, 30));
}
/* Check for click */
Rectangle bounds = {cx - circle_size / 2 - 4, cy - circle_size / 2 - 4, circle_size + 8, circle_size + 8};
if(CheckCollisionPointRec(mouse_world, bounds) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT) &&
!ui_dropdown_captures_click(mouse_world)) {
app->theme_id = i;
refresh_theme_colors(app->theme_id, app->dark_mode);
app->settings_dirty = 1;
}
if(CheckCollisionPointRec(mouse_world, bounds))
app->cursor_clickable = 1;
/* Draw theme name below */
const char *name = g_themes[i].name;
int name_w = flint_text_measure(name, small_font);
flint_text_draw(name, cx - name_w / 2, cy + circle_size / 2 + flint_px(6), small_font, c_text);
}
}
#endif
@@ -524,14 +547,26 @@ settings_tab_draw(InbeApp *app)
TraceLog(LOG_INFO, "INBE: Settings toggled progressive_speed to %d", progressive_speed);
}
if(app->inbe.progressive_speed) {
progressive_start_speed = clampi(progressive_start_speed, SETTINGS_SPEED_MIN, speed);
if(ui_draw_slider(5, content_x, progressive_toggle_y + toggle_h + flint_px(20),
content_w, locale_get("progressive_start_speed_label"),
SETTINGS_SPEED_MIN, speed, &progressive_start_speed, "")) {
app->inbe.progressive_start_speed = progressive_start_speed;
app->settings_preview.progressive_start_speed = progressive_start_speed;
int modify_y = progressive_toggle_y + toggle_h + flint_px(20);
int modify_w = flint_text_measure(locale_get("modify_start_speed_button"), flint_ui_font()) + flint_px(24);
int modify_h = flint_px(36);
int modify_hover = 0;
if(modify_w > content_w)
modify_w = content_w;
if(progressive_start_speed != clampi(progressive_start_speed, SETTINGS_SPEED_MIN, speed)) {
app->inbe.progressive_start_speed = clampi(progressive_start_speed, SETTINGS_SPEED_MIN, speed);
app->settings_preview.progressive_start_speed = app->inbe.progressive_start_speed;
app->settings_dirty = 1;
}
if(ui_draw_generic_button(content_x, modify_y, modify_w, modify_h,
locale_get("modify_start_speed_button"),
UI_BUTTON_STYLE_SECONDARY, &modify_hover)) {
app->modal.active = 1;
app->modal.type = UIModalEditProgressiveStartSpeed;
app->modal.selected_button = 0;
}
}
} else if(app->settings_sub_tab == PRACTICE_SUBTAB_SESSION) {
@@ -589,12 +624,12 @@ settings_tab_draw(InbeApp *app)
if(ui_draw_generic_button(reset_x, reset_y, reset_w, reset_h,
locale_get("reset_to_defaults_label"), UI_BUTTON_STYLE_SECONDARY, &reset_hover)) {
/* Reset to default values */
speed = 8;
speed = DefaultSpeedLevel;
max_rounds = DefaultMaxRounds;
max_breaths = DefaultMaxBreaths;
pause_seconds = DefaultPauseSeconds;
app->inbe.progressive_start_speed = 3;
app->settings_preview.progressive_start_speed = 3;
app->inbe.progressive_start_speed = DefaultProgressiveStartSpeed;
app->settings_preview.progressive_start_speed = DefaultProgressiveStartSpeed;
app->advanced_session_controls = 0;
app->hold_display_mode = HOLD_DISPLAY_CIRCLE;
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
@@ -778,7 +813,6 @@ settings_tab_draw(InbeApp *app)
int import_y = text_y;
int hover_import = 0;
int hover_export = 0;
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
/* Export button */
int export_h = flint_px(36);
@@ -859,24 +893,10 @@ settings_tab_draw(InbeApp *app)
int delete_w = flint_text_measure(locale_get("delete_all_data_button"), font) + flint_px(24);
int delete_x = content_x;
int delete_y = export_y + export_h + flint_px(12);
Rectangle delete_rect = {delete_x, delete_y, delete_w, export_h};
if(CheckCollisionPointRec(mouse_world, delete_rect)) {
DrawRectangle(delete_x, delete_y, delete_w, export_h, c_button_hover);
ui_draw_bevel(delete_x, delete_y, delete_w, export_h, flint_darken(c_button_hover, 40), flint_lighten(c_button_hover, 40));
hover_delete = 1;
app->cursor_clickable = 1;
} else {
DrawRectangle(delete_x, delete_y, delete_w, export_h, c_button);
ui_draw_bevel(delete_x, delete_y, delete_w, export_h, flint_lighten(c_button, 40), flint_darken(c_button, 40));
}
flint_text_draw(locale_get("delete_all_data_button"), delete_x + flint_px(12),
flint_ui_text_y(locale_get("delete_all_data_button"), delete_y, export_h, font),
font, c_text);
/* Handle button clicks */
if(hover_delete && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) &&
!ui_dropdown_captures_click(mouse_world)) {
if(ui_draw_generic_button(delete_x, delete_y, delete_w, export_h,
locale_get("delete_all_data_button"),
UI_BUTTON_STYLE_DANGER, &hover_delete)) {
if(data_has_any()) {
app->modal.active = 1;
app->modal.type = UIModalConfirmDeleteData;
@@ -910,10 +930,13 @@ settings_tab_draw(InbeApp *app)
/* App description */
const char *desc_text = locale_get("about_description");
FlintTextLayout desc_layout = flint_text_layout_parse(desc_text, (Texture2D){0}, FLINT_ICON_TYPE_NONE, font);
flint_text_layout_reflow(&desc_layout, content_w, font, flint_px(10));
flint_text_layout_draw(&desc_layout, content_x, &text_y, font, c_text);
flint_text_layout_free(&desc_layout);
flint_ui_paragraph_draw((FlintUIParagraph){
.text = desc_text,
.width = content_w,
.font = font,
.line_gap = flint_px(10),
.color = c_text,
}, content_x, &text_y);
/* Version info */
text_y += flint_px(20);
@@ -927,20 +950,23 @@ settings_tab_draw(InbeApp *app)
int icon_padding = flint_px(4);
int icon_spacing = flint_px(20);
int icon_btn_w = icon_size + icon_padding * 2;
int total_w = icon_btn_w * 3 + icon_spacing * 2;
int columns = total_w <= content_w ? 3 : 2;
int link_count = 4;
int max_columns = 4;
int total_w = icon_btn_w * max_columns + icon_spacing * (max_columns - 1);
int columns = total_w <= content_w ? max_columns : 2;
int grid_w = icon_btn_w * columns + icon_spacing * (columns - 1);
int links_start_x = content_x + (content_w - grid_w) / 2;
int row_spacing = flint_px(16);
Texture2D icons[3] = {app->discord_icon, app->telegram_icon, app->monero_icon};
UIIconType icon_types[3] = {UI_ICON_TYPE_NONE, UI_ICON_TYPE_TELEGRAM, UI_ICON_TYPE_MONERO};
const char *urls[3] = {
Texture2D icons[4] = {app->discord_icon, app->telegram_icon, app->btc_icon, app->monero_icon};
UIIconType icon_types[4] = {UI_ICON_TYPE_NONE, UI_ICON_TYPE_TELEGRAM, UI_ICON_TYPE_BTC, UI_ICON_TYPE_MONERO};
const char *urls[4] = {
"https://discord.gg/JbGZ4yENDt",
"https://t.me/lotusinbe",
"https://trocador.app/en/anonpay/?ticker_to=btc&network_to=Mainnet&address=bc1qxzcetg50f6epgddc09n82xqn3zswlmk44235y5&donation=True&simple_mode=True&amount=0.001&name=Inner+Breeze&[email protected]&ticker_from=btc&network_from=Mainnet&buttonbgcolor=445588&textcolor=ffffff&bgcolor=eaeaffff",
"https://trocador.app/en/anonpay/?ticker_to=xmr&network_to=Mainnet&address=86CbC3d4a2GhT9auh6X99JhmhTMFKVVk8Q9cLrKTHkBu8LLkoNWgkBeAT3YZrvDM6NczYe8brUJNsTiFmwpWDZYnFG5kzSH&donation=True&simple_mode=True&amount=0.1&name=Inner+Breeze&[email protected]&ticker_from=xmr&network_from=Mainnet&buttonbgcolor=445588&textcolor=ffffff&bgcolor=eaeaffff"
};
for(int i = 0; i < 3; i++) {
for(int i = 0; i < link_count; i++) {
int col = i % columns;
int row = i / columns;
int icon_x = links_start_x + col * (icon_btn_w + icon_spacing) + icon_padding;
@@ -983,6 +1009,10 @@ settings_tab_draw(InbeApp *app)
}
}
if(app->modal.active && app->modal.type == UIModalEditProgressiveStartSpeed) {
settings_draw_progressive_start_speed_editor(app);
}
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
if(app->settings_dirty)
save_settings(app);
+2 -2
View File
@@ -3,7 +3,7 @@
#define INBE_VERSION_MAJOR 1
#define INBE_VERSION_MINOR 2
#define INBE_VERSION_PATCH 2
#define INBE_VERSION_STRING "1.2.2"
#define INBE_VERSION_PATCH 5
#define INBE_VERSION_STRING "1.2.5"
#endif
-7
View File
@@ -1,7 +0,0 @@
# Lotus theme: inbe
background "#E2EEFCFF"
text "#24487CFF"
circle "#7EB7E6FF"
button "#A6CFF2FF"
button_hover "#689ED7FF"
icon "#24487CFF"
-62
View File
@@ -1,62 +0,0 @@
#!/usr/bin/env bash
# update_metadata.sh - Simple version update for website
# This runs automatically before publish to keep version info current
set -e
# Extract version from CHANGELOG.md
get_version() {
if [ -f "CHANGELOG.md" ]; then
grep '^## \[' CHANGELOG.md | head -n 1 | sed 's/^## \[\([^]]*\)\].*/\1/'
else
echo "unknown"
fi
}
echo "=== Updating Build Metadata ==="
# Get current version
VERSION=$(get_version)
echo "Current version: $VERSION"
update_version_in_file() {
local file="$1"
# Replace explicit placeholders in templates.
sed -i "s|VERSION_PLACEHOLDER|$VERSION|g" "$file"
# Replace the already-rendered website version tag too. Older generated
# pages no longer contain VERSION_PLACEHOLDER, so the previous script left
# stale versions such as 1.1.5 in place forever.
sed -i -E "s|(<p[[:space:]]+class=\"version\">)[^<]*(</p>)|\\1$VERSION\\2|g" "$file"
}
# Update index.html
if [ -f "index.html" ]; then
echo "Updating index.html..."
# Create backup
cp index.html index.html.bak
update_version_in_file index.html
echo "✓ index.html updated with version $VERSION"
else
echo "Warning: index.html not found"
fi
# Update builds.html if it exists
if [ -f "builds.html" ]; then
echo "Updating builds.html..."
# Create backup
cp builds.html builds.html.bak
update_version_in_file builds.html
echo "✓ builds.html updated with version $VERSION"
else
echo "builds.html not found, skipping"
fi
echo "=== Metadata Update Complete ==="
+33
View File
@@ -6,6 +6,7 @@ set -e
CHANGELOG_FILE="CHANGELOG.md"
GRADLE_FILE="droid/app/build.gradle"
WINDOWS_RC_FILE="windows/inbe.rc"
CHANGELOG_DIR="fastlane/metadata/android/en-US/changelogs"
# Extract all versions from CHANGELOG
@@ -54,6 +55,38 @@ sed -i "s/^#define INBE_VERSION_STRING .*/#define INBE_VERSION_STRING \"$LATEST_
echo "✓ Updated $VERSION_H_FILE"
if [ -f "$WINDOWS_RC_FILE" ]; then
WINDOWS_VERSION="$MAJOR,$MINOR,$PATCH,0"
sed -i "s/^ FILEVERSION .*/ FILEVERSION $WINDOWS_VERSION/" "$WINDOWS_RC_FILE"
sed -i "s/^ PRODUCTVERSION .*/ PRODUCTVERSION $WINDOWS_VERSION/" "$WINDOWS_RC_FILE"
sed -i "s/^\([[:space:]]*VALUE \"FileVersion\", \).*/\1\"$LATEST_VERSION\"/" "$WINDOWS_RC_FILE"
sed -i "s/^\([[:space:]]*VALUE \"ProductVersion\", \).*/\1\"$LATEST_VERSION\"/" "$WINDOWS_RC_FILE"
echo "✓ Updated $WINDOWS_RC_FILE"
else
echo "Warning: $WINDOWS_RC_FILE not found"
fi
update_website_version_in_file() {
local file="$1"
sed -i "s|VERSION_PLACEHOLDER|$LATEST_VERSION|g" "$file"
sed -i -E "s|(<p[[:space:]]+class=\"version\">)[^<]*(</p>)|\\1$LATEST_VERSION\\2|g" "$file"
}
if [ -f "index.html" ]; then
update_website_version_in_file index.html
echo "✓ Updated index.html"
else
echo "Warning: index.html not found"
fi
if [ -f "builds.html" ]; then
update_website_version_in_file builds.html
echo "✓ Updated builds.html"
else
echo "builds.html not found, skipping"
fi
# Create changelog directory
mkdir -p "$CHANGELOG_DIR"
+1 -1
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

+35
View File
@@ -0,0 +1,35 @@
#include <windows.h>
IDI_APP_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,5,0
PRODUCTVERSION 1,2,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "1.2.5"
VALUE "InternalName", "inbe"
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "1.2.5"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END