Compare commits

...
5 Commits
Author SHA1 Message Date
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
36 changed files with 600 additions and 495 deletions

No files matched your search

+11
View File
@@ -1,4 +1,15 @@
# Changelog
## [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.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

+2 -2
View File
@@ -34,8 +34,8 @@ android {
defaultConfig {
minSdk 19
targetSdk 35
versionCode 23
versionName "1.2.2"
versionCode 25
versionName "1.2.4"
}
@@ -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.
+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.4</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"
}
]
}
+4 -1
View File
@@ -19,6 +19,7 @@ WEB_THEME_PRELOADS = $(foreach file,$(THEME_FILES),--preload-file $(file)@themes
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_PUBLIC_FILES = manifest.json $(shell find web-assets -type f 2>/dev/null)
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):
@@ -48,7 +49,7 @@ $(WEB_RAYLIB_BUILD_DIR)/%.o: $(RAYLIB_DIR)/%.c | $(WEB_RAYLIB_BUILD_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_TARGET): $(BUILD_MAKEFILES) $(SRC) $(WEB_FLINT_SRCS) $(INBE_DIR)/inbe.c $(WEB_SHELL) $(WEB_RAYLIB_A) $(WEB_ASSET_FILES) $(WEB_PUBLIC_FILES) | $(WEB_BUILD_DIR)
$(WEB_CC) $(WEB_CFLAGS) \
-I$(RAYLIB_DIR) \
-I$(INBE_DIR) \
@@ -62,3 +63,5 @@ $(WEB_TARGET): $(BUILD_MAKEFILES) $(SRC) $(WEB_FLINT_SRCS) $(INBE_DIR)/inbe.c $(
$(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)
rsync -a web-assets/ $(WEB_BUILD_DIR)/web-assets/
cp manifest.json $(WEB_BUILD_DIR)/
+14 -2
View File
@@ -39,6 +39,18 @@ echo " Channel: $ITCH_CHANNEL"
echo " Build dir: $WEB_BUILD_DIR"
echo ""
butler push "$WEB_BUILD_DIR" "$ITCH_USER/$ITCH_GAME:$ITCH_CHANNEL" --userversion "$VERSION"
TMPDIR=$(mktemp -d -p /tmp)
cleanup() {
rm -rf "$TMPDIR"
}
trap cleanup EXIT
echo "✓ Published inbe v$VERSION to https://$ITCH_USER.itch.io/$ITCH_GAME"
rsync -a \
--exclude='raylib' \
"$WEB_BUILD_DIR/" "$TMPDIR/"
rsync -a web-assets/ "$TMPDIR/web-assets/"
cp manifest.json "$TMPDIR/"
butler push "$TMPDIR" "$ITCH_USER/$ITCH_GAME:$ITCH_CHANNEL" --userversion "$VERSION"
echo "✓ Published inbe v$VERSION to https://$ITCH_USER.itch.io/$ITCH_GAME"
+3 -8
View File
@@ -15,14 +15,6 @@ 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"
@@ -51,6 +43,7 @@ rsync -av --delete \
--exclude='.DS_Store' \
--exclude='Thumbs.db' \
--exclude='.xdp-*' \
--exclude='inbe.tar.gz' \
--exclude='*.bak' \
--exclude='*.swp' \
--exclude='*.lock' \
@@ -136,6 +129,8 @@ 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 "manifest.json" ] && cp manifest.json "$TMPDIR/"
[ -d "web-assets" ] && rsync -a web-assets/ "$TMPDIR/web-assets/"
if [ -f "$TMPDIR/index.html" ]; then
sed -e 's|/inbe/droid/app/build/outputs/apk/release/app-release.apk|/build/android/app-universal-release.apk|g' \
+1 -1
View File
@@ -1,4 +1,4 @@
speed 8
speed 6
max_rounds 4
max_breaths 30
pause_seconds 2
+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},
+7 -111
View File
@@ -13,7 +13,6 @@
#endif
#include "version.h"
#include "flint_ui.h"
#include "flint_text_layout.h"
#include "flint_dpi.h"
#if !defined(LOTUS_BUILD)
@@ -120,96 +119,6 @@ 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)
{
@@ -219,7 +128,7 @@ load_locale_font(InbeApp *app)
if(app == NULL)
return 0;
font = load_chopped_font(LOCALE_FONT_PNG, LOCALE_FONT_DAT);
font = flint_text_load_chopped_font(LOCALE_FONT_PNG, LOCALE_FONT_DAT, LOCALE_FONT_BASE_SIZE);
if(font.texture.id == 0)
return 0;
@@ -227,9 +136,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 +155,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
@@ -589,7 +492,7 @@ load_settings(InbeApp *app)
inbe_settings_path(settings_path, sizeof(settings_path));
rini_data settings = rini_load(settings_path);
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 +509,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),
@@ -794,7 +697,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 +704,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");
@@ -1146,14 +1050,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);
+4 -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;
@@ -174,9 +176,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 +227,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
+2 -2
View File
@@ -91,8 +91,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);
+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) {
+67 -81
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,20 +253,11 @@ 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;
@@ -302,22 +277,30 @@ manual_tab_draw(InbeApp *app)
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;
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, max_speed)) {
app->inbe.progressive_start_speed = clampi(progressive_start_speed, SETTINGS_SPEED_MIN, max_speed);
app->settings_preview.progressive_start_speed = app->inbe.progressive_start_speed;
app->settings_dirty = 1;
}
if(ui_draw_generic_button(content_x, 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(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 +336,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 +376,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 {
@@ -415,6 +397,10 @@ manual_tab_draw(InbeApp *app)
}
}
if(app->modal.active && app->modal.type == UIModalEditProgressiveStartSpeed) {
settings_draw_progressive_start_speed_editor(app);
}
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) {
app->settings_drag_slider = 0;
if(app->settings_dirty)
+129 -107
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,99 @@ 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_speed != speed || preview->phase != InbePhaseBreathe) {
inbeinit(preview);
apply_settings(preview, speed, max_rounds, max_breaths, pause_seconds);
preview->progressive_speed = 0;
session_reset_round_breathe(preview);
*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->start_speed_preview_speed = 0;
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 +542,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 +619,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 +808,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 +888,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 +925,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);
@@ -983,6 +1001,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 4
#define INBE_VERSION_STRING "1.2.4"
#endif
-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 ==="
+21
View File
@@ -54,6 +54,27 @@ sed -i "s/^#define INBE_VERSION_STRING .*/#define INBE_VERSION_STRING \"$LATEST_
echo "✓ Updated $VERSION_H_FILE"
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