Update practice imagery and Kryon integration

This commit is contained in:
waozi committed 2026-08-21 16:03:39 -03:00
1 parent ccdeb5ae61
commit f7efa49a6b
50 files changed
+171 -428

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
# Inbe Agent Instructions
- Never edit files under `vendor/` from this repository.
- Kryon changes must be made in the core Kryon repository, committed there, pushed there, and then brought into Inbe by updating the Kryon submodule pointer.
- Do not add tests, policy checks, wrappers, compatibility aliases, or generated changes inside `vendor/` from Inbe.
- If a task appears to require a vendor change, stop and switch to the upstream project workflow first.
- Run `make no-vendor-edits` or `make test` before handing work back when a task touches Kryon or other vendored code.
+9 -12
View File
@@ -302,13 +302,12 @@ SYNC_ACCOUNT_TEST := $(TEST_BIN_DIR)/sync_account_test
SYNC_REVIEW_TEST := $(TEST_BIN_DIR)/sync_review_test
FONT_LOCALE_TEST := $(TEST_BIN_DIR)/font_locale_test
FONT_GLYPH_COVERAGE_TEST := $(TEST_BIN_DIR)/font_glyph_coverage_test
GUIDE_OVERLAY_TEST := $(TEST_BIN_DIR)/guide_overlay_test
APP_BOTTOM_NAV_TEST := $(TEST_BIN_DIR)/app_bottom_nav_test
BREATH_TIMING_TEST := $(TEST_BIN_DIR)/breath_timing_test
BREAK_ENGINE_TEST := $(TEST_BIN_DIR)/break_engine_test
ACTIVITY_MONITOR_TEST := $(TEST_BIN_DIR)/activity_monitor_test
SETTINGS_KEYS_TEST := $(TEST_BIN_DIR)/settings_keys_test
TESTS := $(STORAGE_IMPORT_TEST) $(LOCALE_KEYS_TEST) $(SYNC_URL_TEST) $(SYNC_ACCOUNT_TEST) $(SYNC_REVIEW_TEST) $(FONT_LOCALE_TEST) $(FONT_GLYPH_COVERAGE_TEST) $(GUIDE_OVERLAY_TEST) $(APP_BOTTOM_NAV_TEST) $(BREATH_TIMING_TEST) $(BREAK_ENGINE_TEST) $(ACTIVITY_MONITOR_TEST) $(SETTINGS_KEYS_TEST)
TESTS := $(STORAGE_IMPORT_TEST) $(LOCALE_KEYS_TEST) $(SYNC_URL_TEST) $(SYNC_ACCOUNT_TEST) $(SYNC_REVIEW_TEST) $(FONT_LOCALE_TEST) $(FONT_GLYPH_COVERAGE_TEST) $(APP_BOTTOM_NAV_TEST) $(BREATH_TIMING_TEST) $(BREAK_ENGINE_TEST) $(ACTIVITY_MONITOR_TEST) $(SETTINGS_KEYS_TEST)
RUNTIME_ASSET_CFLAGS := -DHAS_LIBCURL=1 $(KRYON_CURL_CFLAGS)
RUNTIME_ASSET_LDLIBS := $(KRYON_CURL_LDLIBS)
@@ -360,7 +359,7 @@ SYSTEM_THEME_CFLAGS :=
SYSTEM_THEME_LDLIBS :=
LOCALE_FILES := $(wildcard locales/*.txt)
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png assets/practices/whm/1.png assets/practices/whm/2.png assets/practices/meditation/1.png assets/pet/egg1.png $(wildcard assets/practices/*/banner.png) assets/practices/sunsalutation/poses_man_sheet.png assets/practices/sunsalutation/poses_woman_sheet.png assets/practices/sunsalutation/transition_01_01_to_02_man_sheet.png assets/practices/sunsalutation/transition_02_02_to_03_man_sheet.png assets/practices/sunsalutation/transition_03_03_to_04_man_sheet.png
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png assets/practices/whm/1.png assets/practices/whm/2.png assets/practices/meditation/1.png assets/pet/egg1.png $(wildcard assets/practices/*/banner.png) assets/practices/sunsalutation/poses_man_sheet.png assets/practices/sunsalutation/poses_woman_sheet.png assets/practices/sunsalutation/transition_01_01_to_02_man_sheet.png assets/practices/sunsalutation/transition_02_02_to_03_man_sheet.png
SOUND_FILES := $(wildcard assets/sounds/*.ogg)
FONT_SUBSET_DIR := assets/fonts/subset
FONT_SUBSET_CORPUS := locales assets/fonts/input_common.txt
@@ -505,6 +504,7 @@ MEDITATION_AUDIO_TRACKS := \
include $(KRYON_DIR)/mk/package-freebsd.mk
.PHONY: web-canvas web-canvas-smoke-test web-compare-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons
.PHONY: no-vendor-edits
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
all: native
@@ -611,7 +611,7 @@ screenshot: $(TARGET)
./scripts/generate-screenshots.sh "$(TARGET)"
.SILENT: test $(TESTS) font-bundle-check audio-test-fixture-check
.SILENT: no-vendor-edits test $(TESTS) font-bundle-check audio-test-fixture-check
## Local parity with the ci.yml gate: unit tests plus the web build (emcc).
## Run before pushing to catch web-only breakage -- e.g. code under
@@ -624,7 +624,11 @@ ci: test web
test-desktop-windows:
./scripts/test-desktop-windows.sh "$(TARGET)"
test: $(TESTS) font-bundle-check audio-test-fixture-check
no-vendor-edits:
bash ./scripts/check-no-vendor-edits.sh
test: no-vendor-edits $(TESTS) font-bundle-check audio-test-fixture-check
bash ./tests/screenshot_scene_test.sh
echo "== Inbe tests =="; \
status=0; \
for test_bin in $(TESTS); do \
@@ -719,13 +723,6 @@ $(FONT_GLYPH_COVERAGE_TEST): tests/font_glyph_coverage_test.c $(FONT_FILES) $(LO
-o $@ \
tests/font_glyph_coverage_test.c
$(GUIDE_OVERLAY_TEST): tests/guide_overlay_test.c $(KRYON_DIR)/src/ui/guide.c $(KRYON_DIR)/src/ui/ui_clip.c $(KRYON_DIR)/include/ui.h | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
-I$(KRYON_DIR) $(KRYON_INCLUDE) \
-o $@ \
tests/guide_overlay_test.c \
$(KRYON_DIR)/src/ui/ui_clip.c
$(APP_BOTTOM_NAV_TEST): tests/app_bottom_nav_test.c src/app/app_nav.h src/app/app.h $(KRY_GEN_DIR)/src/app/app_nav.c $(KRY_GEN_DIR)/src/app/customize_nav.c $(KRY_GEN_DIR)/src/widgets/bottom_nav.c $(KRYON_DIR)/include/ui.h $(KRYON_DIR)/src/core/app_shell.c $(KRYON_DIR)/include/app_shell.h | $(TEST_BIN_DIR)
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE \
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/storage -Isrc/platform/android $(KRYON_INCLUDE) -I$(KRY_GEN_DIR) -I$(KRY_GEN_DIR)/src $(SQLITE_INCLUDE) \
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
status=0
git submodule foreach --recursive '
dirty=0
if ! git diff --quiet --ignore-submodules=none; then
dirty=1
fi
if ! git diff --cached --quiet --ignore-submodules=none; then
dirty=1
fi
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
dirty=1
fi
if [ "$dirty" -ne 0 ]; then
echo "Dirty vendor submodule: $displaypath"
git status --short
exit 1
fi
' || status=1
if [ "$status" -ne 0 ]; then
echo
echo "Do not edit vendor from Inbe. Make changes in the owning repo, commit and push there, then update only the submodule pointer here."
exit 1
fi
+8 -8
View File
@@ -24,14 +24,14 @@ SCREENSHOT_STYLE="${SCREENSHOT_STYLE:-2}"
ANALYSIS_FILE="$OUT_DIR/screenshot-analysis.tsv"
SCENES=(
"home:01-practice-home:0:0:Practice home"
"patterns:02-pattern-breathing:10:0:Pattern breathing session"
"habits_overview:03-habits-overview:7:0:Habits overview"
"habits_stats:04-habit-statistics:2:0:Habit statistics"
"wim_hof_session:05-wim-hof-session:1:1:Wim Hof session"
"meditation_session:06-meditation-session:4:0:Meditation session"
"sun_salutation_session:07-sun-salutation-session:3:0:Sun salutation session"
"cobalt_dark:08-cobalt-dark-practice:11:1:Cobalt dark practice theme"
"home:01-practice-home:-1:0:Practice home"
"patterns:02-pattern-breathing:-1:0:Pattern breathing session"
"habits_overview:03-habits-overview:-1:0:Habits overview"
"habits_stats:04-habit-statistics:-1:0:Habit statistics"
"wim_hof_session:05-wim-hof-session:-1:0:Wim Hof session"
"meditation_session:06-meditation-session:-1:0:Meditation session"
"practice_manual_whm:07-wim-hof-how-to:-1:0:Wim Hof Method how to"
"cobalt_dark:08-cobalt-dark-pattern-breathing:11:1:Cobalt dark Pattern Breathing"
)
BUCKETS=(
+1 -1
View File
@@ -2032,7 +2032,7 @@ app_update_draw(void *vapp, Rectangle viewport) {
DrawRectangle(0, 0, view_width, view_height, GetThemeBackground());
profile_update_start = app_profile_now();
updateapp(app);
DrawUIOverlays();
Overlays();
app_profile_accum(&g_app_profile.update_total,
&g_app_profile.update_max,
profile_update_start);
+1 -5
View File
@@ -280,12 +280,10 @@ int app_draw_close_dropdown_title_bar(InbeApp *app, UITitleBarDropdown dropdown,
typedef struct WhmPracticeState {
Texture2D image_1;
Texture2D image_2;
Texture2D banner;
} WhmPracticeState;
typedef struct MeditationPracticeState {
Texture2D image_1;
Texture2D banner;
int duration_seconds;
int remaining_seconds;
int frame_ticks;
@@ -311,9 +309,8 @@ typedef struct MeditationPracticeState {
} MeditationPracticeState;
typedef struct SunSalutationPracticeState {
Texture2D banner;
Texture2D pose_sheets[2];
Texture2D transition_sheets[2][3];
Texture2D transition_sheets[2][2];
int step;
int repetition;
int repetitions;
@@ -338,7 +335,6 @@ typedef struct HabitSessionEditState {
} HabitSessionEditState;
typedef struct InbePatterns {
Texture2D banner;
int preset;
int custom[4]; /* inhale, hold-in, exhale, hold-out seconds */
int duration_minutes; /* 0 = open-ended */
+1 -1
View File
@@ -242,7 +242,7 @@ app_breaks_window_update :: (app: InbeApp*) {
}
# Manual hit-test of the break overlay's button row (layout mirrored from
# break_overlay_draw; DrawUITextButton centers each button on its x).
# break_overlay_draw; TextButton centers each button on its x).
app_breaks_window_click :: (app: InbeApp*, t: int, x: int, y: int,
view_w: int, view_h: int) {
timer := &app->breaks.timers[t]
+17 -4
View File
@@ -43,6 +43,8 @@ int kry_write_png_file(const char *path, const unsigned char *rgba,
#include <process.h>
__declspec(dllimport) LRESULT __stdcall SendMessageW(HWND, UINT, WPARAM, LPARAM);
__declspec(dllimport) int __stdcall MessageBoxA(HWND, const char *, const char *, UINT);
__declspec(dllimport) HANDLE __stdcall LoadImageW(HINSTANCE, LPCWSTR, UINT, int, int, UINT);
__declspec(dllimport) int __stdcall GetSystemMetrics(int);
#define MB_OK 0u
#define MB_ICONERROR 0x10u
#define WIN_ERROR_LOG_CAP 2048
@@ -97,7 +99,7 @@ set_desktop_window_icon(void)
#if defined(_WIN32)
{
HWND window=(HWND)GetWindowHandle(); HMODULE instance=GetModuleHandleW(NULL);
LPCWSTR resource=MAKEINTRESOURCEW(INBE_APP_ICON_RESOURCE);
LPCWSTR resource=(LPCWSTR)(uintptr_t)INBE_APP_ICON_RESOURCE;
HICON large=(HICON)LoadImageW(instance,resource,INBE_IMAGE_ICON,GetSystemMetrics(INBE_SM_CXICON),GetSystemMetrics(INBE_SM_CYICON),0);
HICON small=(HICON)LoadImageW(instance,resource,INBE_IMAGE_ICON,GetSystemMetrics(INBE_SM_CXSMICON),GetSystemMetrics(INBE_SM_CYSMICON),0);
if(window){if(large)SendMessageW(window,INBE_WM_SETICON,INBE_ICON_BIG,(LPARAM)large);if(small)SendMessageW(window,INBE_WM_SETICON,INBE_ICON_SMALL,(LPARAM)small);}
@@ -203,6 +205,8 @@ typedef struct ScreenshotRequest {
char output[512];
} ScreenshotRequest;
#define SCREENSHOT_THEME_CURRENT (-1)
#if defined(_WIN32) && !ANDROID_BUILD
static FILE *win_log_file;
static char win_recent_errors[WIN_ERROR_LOG_CAP];
@@ -517,7 +521,7 @@ parse_screenshot_args(int argc, char **argv, ScreenshotRequest *request)
*request = (ScreenshotRequest){
.width = config.width,
.height = config.height,
.theme_id = THEME_SKY,
.theme_id = SCREENSHOT_THEME_CURRENT,
.dark_mode = 0,
.theme_style = THEME_STYLE_SYSTEM
};
@@ -559,8 +563,8 @@ parse_screenshot_args(int argc, char **argv, ScreenshotRequest *request)
if(request->theme_style < THEME_STYLE_SYSTEM ||
request->theme_style > THEME_STYLE_MATERIAL)
request->theme_style = THEME_STYLE_SYSTEM;
if(request->theme_id < 0 || request->theme_id >= THEME_COUNT)
request->theme_id = THEME_SKY;
if(request->theme_id < SCREENSHOT_THEME_CURRENT || request->theme_id >= THEME_COUNT)
request->theme_id = SCREENSHOT_THEME_CURRENT;
}
#endif
@@ -622,6 +626,13 @@ screenshot_apply_theme(InbeApp *app, int theme_id, int dark_mode)
{
if(app == NULL)
return;
if(theme_id == SCREENSHOT_THEME_CURRENT) {
app->theme_source = APP_THEME_SOURCE_SYSTEM;
app->theme_mode = APP_THEME_SYSTEM;
app_refresh_theme(app);
return;
}
app->theme_source = APP_THEME_SOURCE_APP;
app->theme_id = theme_id;
app->theme_mode = dark_mode ? APP_THEME_DARK : APP_THEME_LIGHT;
app->dark_mode = dark_mode != 0;
@@ -758,7 +769,9 @@ setup_screenshot_scene(InbeApp *app, const ScreenshotRequest *request)
app->inbe.screen = InbeScreenProfile;
} else if(strcmp(request->scene, "cobalt_dark") == 0) {
screenshot_apply_theme(app, THEME_COBALT, 1);
app->exercise_type = EXERCISE_PATTERNS;
app->main_tab = APP_MAIN_TAB_PRACTICE;
app->practice_tab = PRACTICE_TAB_PLAY;
app->inbe.screen = InbeScreenStart;
} else if(strcmp(request->scene, "patterns") == 0) {
app->exercise_type = EXERCISE_PATTERNS;
@@ -9,9 +9,6 @@ meditation_practice_init :: (app: InbeApp*) {
if app->meditation.image_1.id == 0 {
app->meditation.image_1 = app_load_asset_texture("practices/meditation/1.png")
}
if app->meditation.banner.id == 0 {
app->meditation.banner = app_load_asset_texture("practices/meditation/banner.png")
}
meditation_music_init(app)
}
@@ -19,8 +16,6 @@ meditation_practice_destroy :: (app: InbeApp*) {
if app != NULL {
app_unload_texture(app->meditation.image_1)
app->meditation.image_1 = (Texture2D){0}
app_unload_texture(app->meditation.banner)
app->meditation.banner = (Texture2D){0}
}
meditation_music_unload(app)
}
@@ -106,9 +106,6 @@ patterns_practice_init :: (app: InbeApp*) {
if app == nil {
return
}
if app->patterns.banner.id == 0 {
app->patterns.banner = app_load_asset_texture("practices/patterns/banner.png")
}
app->patterns.preset = PATTERNS_PRESET_BOX
for int i = 0; i < 4; i++ {
app->patterns.custom[i] = preset_ratio(PATTERNS_PRESET_BOX, i)
@@ -120,8 +117,6 @@ patterns_practice_destroy :: (app: InbeApp*) {
if app == nil {
return
}
app_unload_texture(app->patterns.banner)
app->patterns.banner = (Texture2D){0}
}
patterns_practice_start :: (app: InbeApp*) {
@@ -12,7 +12,7 @@
#define SUN_SALUTATION_POSE_SHEET_COLS 4
#define SUN_SALUTATION_POSE_FRAME_W 106
#define SUN_SALUTATION_POSE_FRAME_H 96
#define SUN_SALUTATION_TRANSITION_COUNT 3
#define SUN_SALUTATION_TRANSITION_COUNT 2
#define SUN_SALUTATION_TRANSITION_FRAME_COUNT 8
#define SUN_SALUTATION_TRANSITION_SHEET_COLS 8
#define SUN_SALUTATION_SECONDS_MIN 3
@@ -77,10 +77,6 @@ sun_salutation_practice_init :: (app: InbeApp*) {
return
}
if app->sun_salutation.banner.id == 0 {
app->sun_salutation.banner =
app_load_asset_texture("practices/sunsalutation/banner.png")
}
if app->sun_salutation.pose_sheets[SUN_SALUTATION_FIGURE_MAN].id == 0 {
app->sun_salutation.pose_sheets[SUN_SALUTATION_FIGURE_MAN] =
app_load_asset_texture("practices/sunsalutation/poses_man_sheet.png")
@@ -93,10 +89,6 @@ sun_salutation_practice_init :: (app: InbeApp*) {
app->sun_salutation.transition_sheets[SUN_SALUTATION_FIGURE_MAN][1] =
app_load_asset_texture("practices/sunsalutation/transition_02_02_to_03_man_sheet.png")
}
if app->sun_salutation.transition_sheets[SUN_SALUTATION_FIGURE_MAN][2].id == 0 {
app->sun_salutation.transition_sheets[SUN_SALUTATION_FIGURE_MAN][2] =
app_load_asset_texture("practices/sunsalutation/transition_03_03_to_04_man_sheet.png")
}
if app->sun_salutation.repetitions < 2 ||
app->sun_salutation.repetitions > 12 {
app->sun_salutation.repetitions = SUN_SALUTATION_DEFAULT_REPETITIONS
@@ -117,9 +109,6 @@ sun_salutation_practice_destroy :: (app: InbeApp*) {
return
}
app_unload_texture(app->sun_salutation.banner)
app->sun_salutation.banner = (Texture2D){0}
for int i = 0; i < SUN_SALUTATION_FIGURE_COUNT; i++ {
app_unload_texture(app->sun_salutation.pose_sheets[i])
app->sun_salutation.pose_sheets[i] = (Texture2D){0}
@@ -269,9 +269,6 @@ sun_salutation_transition_index_for_step :: (step: int) -> int #private {
if step == 1 {
return 1
}
if step == 2 {
return 2
}
return -1
}
-4
View File
@@ -12,9 +12,6 @@ whm_practice_init :: (app: InbeApp*) {
if app->whm.image_2.id == 0 {
app->whm.image_2 = app_load_asset_texture("practices/whm/2.png")
}
if app->whm.banner.id == 0 {
app->whm.banner = app_load_asset_texture("practices/whm/banner.png")
}
}
whm_practice_destroy :: (app: InbeApp*) {
@@ -23,7 +20,6 @@ whm_practice_destroy :: (app: InbeApp*) {
}
app_unload_texture(app->whm.image_1)
app_unload_texture(app->whm.image_2)
app_unload_texture(app->whm.banner)
}
whm_practice_start :: (app: InbeApp*) {
+3 -3
View File
@@ -265,7 +265,7 @@ break_overlay_draw_sized :: (app: InbeApp*, w: int, h: int) {
snprintf(locked_label, sizeof(locked_label), GetLocaleText("break_lock_note"), timer->lock_buttons_s)
DrawCenteredUIControlText(locked_label, button_x + button_w / 2, button_y + ScaleUIPx(16), UI_TEXT_12, muted)
} else {
if DrawUITextButton(button_x, button_y, GetLocaleText("break_postpone_button"), &hover) {
if TextButton(4101, button_x, button_y, GetLocaleText("break_postpone_button"), &hover) {
break_engine_postpone(&app->breaks, t)
return
}
@@ -275,7 +275,7 @@ break_overlay_draw_sized :: (app: InbeApp*, w: int, h: int) {
if timer->show_skip != 0 {
if !locked {
if DrawUITextButton(button_x, button_y, GetLocaleText("break_skip_button"), &hover) {
if TextButton(4102, button_x, button_y, GetLocaleText("break_skip_button"), &hover) {
break_engine_skip(&app->breaks, t)
return
}
@@ -284,7 +284,7 @@ break_overlay_draw_sized :: (app: InbeApp*, w: int, h: int) {
}
if t == BREAK_MICRO {
if DrawUITextButton(button_x, button_y, GetLocaleText("break_rest_now_button"), &hover) {
if TextButton(4103, button_x, button_y, GetLocaleText("break_rest_now_button"), &hover) {
break_engine_force_break(&app->breaks, BREAK_REST)
return
}
+28 -64
View File
@@ -156,28 +156,6 @@ practice_screen_handle_config_title :: (app: InbeApp*, title: const char*, modal
return 1
}
practice_card_color_top :: (exercise: int) -> Color {
id := practice_clamp_id(exercise)
if id == EXERCISE_MEDITATION {
return (Color){78, 126, 164, 255}
}
if id == EXERCISE_SUN_SALUTATION {
return (Color){213, 134, 72, 255}
}
return (Color){72, 142, 128, 255}
}
practice_card_color_bottom :: (exercise: int) -> Color {
id := practice_clamp_id(exercise)
if id == EXERCISE_MEDITATION {
return (Color){52, 74, 122, 255}
}
if id == EXERCISE_SUN_SALUTATION {
return (Color){177, 87, 85, 255}
}
return (Color){43, 93, 118, 255}
}
practice_card_radius_px :: () -> int #private {
return ScaleUIPx(12)
}
@@ -196,54 +174,40 @@ practice_card_banner_bottom_padding :: () -> int #private {
return ScaleUIPx(6)
}
practice_draw_card_banner :: (texture: Texture2D, dest: Rectangle,
exercise: int) {
radius := practice_card_radius_px()
style: UIPictureStyle
if texture.id == 0 || texture.width <= 0 || texture.height <= 0 || dest.width <= 0 || dest.height <= 0 {
return
}
if radius < ScaleUIPx(4) {
radius = ScaleUIPx(4)
}
DrawRectangleRounded(dest, practice_card_roundness(dest), 10, GetThemeBackground())
style = (UIPictureStyle){
.background = GetThemeBackground(),
.tonal_overlay = Fade(practice_card_color_bottom(exercise), 0.20f),
.surface_overlay = Fade(GetThemeSurface(), 0.16f),
.scrim_top = Fade(GetThemeBackground(), 0.02f),
.scrim_bottom = Fade(GetThemeBackground(), 0.26f),
.outline = Fade(GetThemeText(), 0.22f),
.roundness = 0.0f,
.radius_px = radius,
.segments = 10,
.outline_px = 0
}
UIDrawStyledCoverPicture(texture, dest, style)
DrawRectangleRoundedLinesEx(dest, practice_card_roundness(dest), 10, ScaleUIPx(1),
Fade(GetThemeText(), 0.22f))
}
practice_card_banner :: (app: const InbeApp*, exercise: int) -> Texture2D {
practice_card_banner_asset_path :: (exercise: int) -> const char* #private {
id := practice_clamp_id(exercise)
if app == NULL {
return (Texture2D){0}
}
if id == EXERCISE_WIM_HOF {
return app->whm.banner
return "practices/whm/banner.png"
}
if id == EXERCISE_SUN_SALUTATION {
return app->sun_salutation.banner
return "practices/sunsalutation/banner.png"
}
if id == EXERCISE_MEDITATION {
return app->meditation.banner
return "practices/meditation/banner.png"
}
if id == EXERCISE_PATTERNS {
return app->patterns.banner
return "practices/patterns/banner.png"
}
return (Texture2D){0}
return NULL
}
practice_draw_card_banner :: (asset_path: const char*, dest: Rectangle) {
if asset_path == NULL || asset_path[0] == '\0' || dest.width <= 0 || dest.height <= 0 {
return
}
Picture((PictureProps){
.asset_path = asset_path,
.bounds = dest,
.tint = WHITE,
.fit = PICTURE_FIT_COVER,
.style = (PictureStyle){
.enabled = 1,
.radius_px = practice_card_radius_px(),
.outline = Fade(GetThemeText(), 0.22f),
.outline_px = ScaleUIPx(1)
}
})
}
practice_next_visible :: (app: InbeApp*, dir: int) -> int {
@@ -941,11 +905,11 @@ page start(app: InbeApp*) {
card := (Rectangle){(float)x, (float)y, (float)card_w, (float)card_h}
app->practice_home_bounds_card = card
app->practice_home_bounds_valid = 1
banner: Texture2D = practice_card_banner(app, app->exercise_type)
if banner.id != 0 {
practice_draw_card_banner(banner, card, app->exercise_type)
banner_path := practice_card_banner_asset_path(app->exercise_type)
if banner_path != NULL {
practice_draw_card_banner(banner_path, card)
} else {
DrawRectangleGradientV(x, y, card_w, card_h, practice_card_color_top(app->exercise_type), practice_card_color_bottom(app->exercise_type))
DrawRectangleRounded(card, practice_card_roundness(card), 10, GetThemeSurface())
DrawRectangleRoundedLinesEx(card, practice_card_roundness(card), 10, ScaleUIPx(1),
Fade(GetThemeText(), 0.22f))
}
+1 -1
View File
@@ -278,7 +278,7 @@ settings_breaks_draw :: (app: InbeApp*, x: int, w: int, y: int*) {
button_w = ScaleUIPx(200)
}
rest_hover := 0
if DrawUITextButton(x, *y, GetLocaleText("settings_breaks_rest_now"), &rest_hover) {
if TextButton(4201, x, *y, GetLocaleText("settings_breaks_rest_now"), &rest_hover) {
app_breaks_rest_break_now(app)
}
*y += ScaleUIPx(60)
+3 -3
View File
@@ -203,7 +203,7 @@ GetUIControlTextY(const char *text, int y, int h, int font)
}
void
DrawUIText(const char *text, int x, int y, int fontSize, Color color)
UIText(const char *text, int x, int y, int fontSize, Color color)
{
(void)text;
(void)x;
@@ -235,7 +235,7 @@ FormatLocaleText(char *out, size_t out_size, const char *key, ...)
}
int
DrawUIHref(HrefProps link)
UIHref(HrefProps link)
{
(void)link;
return 0;
@@ -393,7 +393,7 @@ EndUIScrollPage(UIScrollPage page)
}
int
DrawUIReturnTitleBar(Texture2D return_icon, const char *title, int height)
UIReturnTitleBar(Texture2D return_icon, const char *title, int height)
{
(void)return_icon;
(void)title;
-296
View File
@@ -1,296 +0,0 @@
#include "ui.h"
#include "theme.h"
#include "ui_color.h"
#include "ui_dpi.h"
#include "ui_text.h"
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
int ui_view_width = 320;
int ui_view_height = 560;
static int failures = 0;
int g_ui_input_blocked = 0;
static int icon_call_count = 0;
static int icon_click_call = 0;
static int icon_saw_blocked = 0;
static int pressed_key = 0;
void
ui_set_input_blocked(int blocked)
{
g_ui_input_blocked = blocked != 0;
}
void
SetUIModalCapture(Rectangle bounds)
{
(void)bounds;
}
int
DrawUIIconButton(IconButtonProps button)
{
(void)button;
icon_call_count++;
if(g_ui_input_blocked)
icon_saw_blocked = 1;
return icon_click_call == icon_call_count;
}
int
UIHoverEffectsEnabled(void)
{
return !g_ui_input_blocked;
}
int
ScaleUIPx(int value)
{
return value;
}
int
ui_clampi(int value, int min_value, int max_value)
{
if(value < min_value)
return min_value;
if(value > max_value)
return max_value;
return value;
}
int
GetUIFontSize(void)
{
return UI_TEXT_16;
}
int
ui_paragraph_height(UIParagraphSpec paragraph)
{
(void)paragraph;
return 34;
}
void
DrawUIParagraph(UIParagraphSpec paragraph, int x, int *y)
{
(void)paragraph;
(void)x;
if(y != NULL)
*y += 34;
}
Color
GetThemeButton(void)
{
return (Color){80, 90, 100, 255};
}
Color
GetThemeText(void)
{
return (Color){240, 240, 240, 255};
}
Color
DarkenUIColor(Color color, int amount)
{
(void)amount;
return color;
}
void
DrawUIText(const char *text, int x, int y, int font_size, Color color)
{
(void)text;
(void)x;
(void)y;
(void)font_size;
(void)color;
}
void
BeginScissorMode(int x, int y, int width, int height)
{
(void)x;
(void)y;
(void)width;
(void)height;
}
void
EndScissorMode(void)
{
}
bool
IsKeyPressed(int key)
{
return pressed_key == key;
}
void DrawRectangle(int posX, int posY, int width, int height, Color color)
{
(void)posX; (void)posY; (void)width; (void)height; (void)color;
}
void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color)
{
(void)rec; (void)lineThick; (void)color;
}
void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color)
{
(void)rec; (void)roundness; (void)segments; (void)color;
}
void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color)
{
(void)rec; (void)roundness; (void)segments; (void)color;
}
void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
{
(void)v1; (void)v2; (void)v3; (void)color;
}
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
{
(void)startPos; (void)endPos; (void)thick; (void)color;
}
#include "src/ui/guide.c"
static GuideOverlayProps
test_guide(int *step)
{
static UIGuideStep steps[3] = {
{{20, 20, 80, 30}, "First"},
{{20, 70, 80, 30}, "Second"},
{{20, 120, 80, 30}, "Third"}
};
return (GuideOverlayProps){
.steps = steps,
.count = 3,
.step = step,
.view_width = 320,
.view_height = 560,
.reserved_top = 0,
.reserved_bottom = 48,
.max_width = 240
};
}
static void
reset_input(void)
{
g_ui_input_blocked = 0;
icon_call_count = 0;
icon_click_call = 0;
icon_saw_blocked = 0;
pressed_key = 0;
}
static void
expect(int condition, const char *message)
{
if(!condition) {
fprintf(stderr, "FAIL %s\n", message);
failures++;
}
}
static void
test_blocks_passthrough(void)
{
int step = 0;
UIGuideResult result;
reset_input();
result = DrawUIGuideOverlay(test_guide(&step));
expect(!result.closed && !result.finished && !result.changed,
"plain draw should not change guide state");
expect(!g_ui_input_blocked, "guide must restore unblocked input after draw");
expect(!icon_saw_blocked, "guide buttons should be evaluated while temporarily unblocked");
expect(UIHoverEffectsEnabled(), "guide must restore hover effects after draw");
g_ui_input_blocked = 1;
result = DrawUIGuideOverlay(test_guide(&step));
expect(!result.closed && !result.finished && !result.changed,
"plain draw with preblocked input should not change guide state");
expect(g_ui_input_blocked, "guide must restore preblocked input after draw");
}
static void
test_next_back_close_finish(void)
{
int step = 0;
UIGuideResult result;
reset_input();
icon_click_call = 2;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.changed && step == 1, "next button should advance step");
expect(!g_ui_input_blocked, "next button should restore unblocked input");
reset_input();
icon_click_call = 2;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.changed && step == 0, "back button should return to previous step");
expect(!g_ui_input_blocked, "back button should restore unblocked input");
reset_input();
icon_click_call = 1;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.closed, "close button should close guide");
expect(!g_ui_input_blocked, "close button should restore unblocked input");
step = 2;
reset_input();
icon_click_call = 3;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.finished, "check button should finish guide on last step");
expect(!g_ui_input_blocked, "finish button should restore unblocked input");
}
static void
test_keyboard_navigation(void)
{
int step = 0;
UIGuideResult result;
reset_input();
pressed_key = KEY_RIGHT;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.changed && step == 1, "right key should advance guide");
reset_input();
pressed_key = KEY_LEFT;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.changed && step == 0, "left key should go back");
reset_input();
pressed_key = KEY_ESCAPE;
result = DrawUIGuideOverlay(test_guide(&step));
expect(result.closed, "escape key should close guide");
}
int
main(void)
{
test_blocks_passthrough();
test_next_back_close_finish();
test_keyboard_navigation();
if(failures != 0) {
fprintf(stderr, "%d guide overlay test failure(s)\n", failures);
return 1;
}
printf("guide overlay tests passed\n");
return 0;
}
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SCRIPT="$ROOT_DIR/scripts/generate-screenshots.sh"
fail() {
echo "FAIL $*" >&2
exit 1
}
grep -q 'SCREENSHOT_STYLE="${SCREENSHOT_STYLE:-2}"' "$SCRIPT" ||
fail "screenshots must default to Material style"
mapfile -t scenes < <(
awk '
/^SCENES=\(/ { in_scenes = 1; next }
in_scenes && /^\)/ { exit }
in_scenes {
gsub(/^[[:space:]]*"/, "")
gsub(/"[[:space:]]*$/, "")
if($0 != "") print
}
' "$SCRIPT"
)
[[ "${#scenes[@]}" -eq 8 ]] ||
fail "expected 8 Play screenshot scenes, got ${#scenes[@]}"
for forbidden in 'break_exercises' 'rest_break' 'sun_salutation_session' \
'07-sun-salutation-session' '08-cobalt-dark-practice'; do
if printf '%s\n' "${scenes[@]}" | grep -q "$forbidden"; then
fail "forbidden screenshot scene is still present: $forbidden"
fi
done
for i in 0 1 2 3 4 5 6; do
IFS=: read -r scene slug theme dark expected <<<"${scenes[$i]}"
[[ "$theme" = "-1" ]] ||
fail "$slug should keep the current/system theme, got theme=$theme"
[[ "$dark" = "0" ]] ||
fail "$slug should not force dark mode, got dark=$dark"
done
IFS=: read -r scene slug theme dark expected <<<"${scenes[6]}"
[[ "$scene" = "practice_manual_whm" && "$slug" = "07-wim-hof-how-to" ]] ||
fail "slot 7 must be Wim Hof Method How To"
IFS=: read -r scene slug theme dark expected <<<"${scenes[7]}"
[[ "$scene" = "cobalt_dark" && "$slug" = "08-cobalt-dark-pattern-breathing" ]] ||
fail "slot 8 must be Cobalt Dark Pattern Breathing"
[[ "$theme" = "11" && "$dark" = "1" ]] ||
fail "Cobalt Dark must explicitly force theme=11 dark=1"
echo "PASS screenshot scene contract"
+1 -1