Fix guide placement and keep glow specific to Lightfield

This commit is contained in:
waozi committed 2026-09-19 13:12:26 -03:00
1 parent f13ad7eae6
commit 5b5572e822
11 files changed
+123 -103

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
X("dark_mode") \
X("theme_mode") \
X("glow_effects") \
X("style_lightfield_glow") \
X("orientation_mode") \
X("ui_scale") \
X("main_tab") \
+8 -3
View File
@@ -220,7 +220,7 @@ save_settings :: (app: InnerBreeze*) {
save_setting_int("theme_source", app->theme_source)
save_setting_int("dark_mode", app->dark_mode)
save_setting_int("theme_mode", app->theme_mode)
save_setting_int("glow_effects", app->glow_effects_enabled ? 1 : 0)
save_setting_int("style_lightfield_glow", app->lightfield_glow_enabled ? 1 : 0)
save_setting_int("orientation_mode", app->orientation_mode)
save_setting_int("ui_scale", app->ui_scale_tenths)
save_setting_int("navigation_mode", app->navigation_mode)
@@ -638,8 +638,13 @@ app_load_settings :: (app: InnerBreeze*) -> int {
APP_THEME_SOURCE_SYSTEM)
load_clamped_setting(&settings_cache, &app->theme_mode, "theme_mode",
APP_THEME_SYSTEM, APP_THEME_SYSTEM, APP_THEME_DARK)
load_bool_setting(&settings_cache, &app->glow_effects_enabled,
"glow_effects", 0)
# Keep the old preference for Lightfield only, until its own choice exists.
legacy_glow := settings_cache_get_int(&settings_cache, "glow_effects", 0)
load_bool_setting(&settings_cache, &app->lightfield_glow_enabled,
"style_lightfield_glow", legacy_glow)
if settings_cache_get(&settings_cache, "style_lightfield_glow") == nil {
save_setting_int("style_lightfield_glow", app->lightfield_glow_enabled)
}
load_clamped_setting(&settings_cache, &app->orientation_mode,
"orientation_mode", APP_ORIENTATION_SYSTEM,
APP_ORIENTATION_SYSTEM, APP_ORIENTATION_SENSOR)
+6
View File
@@ -35,10 +35,16 @@ style_pack_label :: (index: int) -> const char* #export {
static applied_style: int = -1
static applied_colors: ThemeColors
style_pack_has_glow :: (index: int) -> int #export {
return index == 3
}
app_apply_style :: (app: InnerBreeze*) #export {
if app == NULL {
return
}
SetFancyEffectsEnabled(!style_pack_has_glow(app->style_index) ||
app->lightfield_glow_enabled)
scheme := GetThemeScheme()
colors := (ThemeColors){
.background = GetThemeBackground(),
+2 -1
View File
@@ -584,6 +584,7 @@ InnerBreeze :: struct {
tutorial_seen: int
habits_guide_step: int
habits_guide_seen: int
habits_guide_anchors: [6] Rectangle
exercise_manual_seen_mask: int
practice_home_scroll: int
practice_home_swipe: SwipeGesture
@@ -597,7 +598,7 @@ InnerBreeze :: struct {
theme_source: int
dark_mode: int
theme_mode: int
glow_effects_enabled: int
lightfield_glow_enabled: int
orientation_mode: int
ui_scale_tenths: int
navigation_mode: int
-1
View File
@@ -124,7 +124,6 @@ app_refresh_theme :: (app: InnerBreeze*) {
}
SetThemeMode((ThemeMode)app->theme_mode)
SetFancyEffectsEnabled(app->glow_effects_enabled)
#if ANDROID {
SetSystemThemeDarkMode(android_device_system_dark() != 0)
+8
View File
@@ -233,6 +233,14 @@ setup_screenshot_scene :: (app: InnerBreeze*, request: const ScreenshotRequest*)
storage_elist_create_list("Home", nil)
storage_elist_create_list("Weekend", nil)
app->elist.loaded = 0
} else if strncmp(request->scene, "habits_guide_", 13) == 0 {
app->main_tab = APP_MAIN_TAB_HABITS
app->breathing.screen = ScreenHabits
app->habits_guide_seen = 0
app->habits_guide_step = clampi(atoi(request->scene + 13), 0, 5)
if strcmp(request->scene + 13, "empty") == 0 {
app->habits.count = 0
}
} else if strcmp(request->scene, "statistics") == 0 {
app->main_tab = APP_MAIN_TAB_HABITS
app->habits.tab = HABIT_TAB_STATISTICS
+31 -7
View File
@@ -1,6 +1,7 @@
#import "app.h"
#import "runtime/modal.h"
#import "runtime/guide.h"
#import "runtime/paragraph.h"
#import "runtime/reorder.h"
#import "runtime/toolbar.h"
#import <stdio.h>
@@ -46,8 +47,11 @@ AppModalFrame :: (width: int, height: int, title: const char*, left_icon_type: i
.content_w = (int)layout.content.width, .content_h = (int)layout.content.height
}
SetModalCapture(layout.panel)
input := SaveFrameState()
pointer := input.mouse_world_override_enabled ? input.mouse_world_override
: GetScreenToWorld2D(GetMousePosition(), input.camera)
dismissal := ModalOutsideDismissalFor(IsMouseButtonReleased(MOUSE_BUTTON_LEFT),
ReleaseConsumed(), CheckCollisionPointRec(GetMousePosition(), layout.panel))
ReleaseConsumed(), CheckCollisionPointRec(pointer, layout.panel))
if dismissal.dismissed {
ConsumeRelease()
frame.right_clicked = 1
@@ -89,17 +93,30 @@ AppGuideOverlay :: (guide: GuideOverlayProps) -> UIGuideResult #export {
widget_frame(StyleKindGuide(), 17), widget_frame(StyleKindGuide(), 15))
step := GuideStepFor(*guide.step, guide.count)
anchor := guide.steps[step].anchor
if anchor.width <= 0 || anchor.height <= 0 {
return result
}
if metrics.button_size < Scale(44) {
metrics.button_size = Scale(44)
}
if metrics.close_size < Scale(44) {
metrics.close_size = Scale(44)
}
tip_width := GuideTipWidth(width, guide.max_width, metrics)
maximum_height := GuideMaxTipHeight(height, guide.reserved_top, guide.reserved_bottom, metrics)
font := GuideParagraphFontFor(guide.paragraph_font, 0, AppFontSize())
gap := GuideLineGapFor(guide.line_gap, metrics)
gap := ParagraphDefaultLineGap(GetScale())
text_width := tip_width - metrics.pad * 2
text_height := AppParagraphHeight(guide.steps[step].text, text_width, font, gap)
paragraph := ParseTextLayout(guide.steps[step].text, (Texture2D){0}, ICON_NONE, 0)
ReflowTextLayout(&paragraph, text_width, font, gap)
text_height := GetTextLayoutHeight(&paragraph)
while GuideShouldShrinkParagraphFont(text_height,
GuideParagraphHeightLimit(maximum_height, metrics), font, AppSmallFontSize()) {
font--
text_height = AppParagraphHeight(guide.steps[step].text, text_width, font, gap)
ReflowTextLayout(&paragraph, text_width, font, gap)
text_height = GetTextLayoutHeight(&paragraph)
}
FreeTextLayout(&paragraph)
tip := GuideTipBounds(anchor, tip_width, GuideTipHeight(text_height, maximum_height, metrics),
width, height, guide.reserved_top, guide.reserved_bottom, metrics)
layout := GuideLayoutFor(tip, text_width, text_height, step, guide.count, metrics)
@@ -113,6 +130,13 @@ AppGuideOverlay :: (guide: GuideOverlayProps) -> UIGuideResult #export {
Box(scrim.left, scrim_color, BLANK)
Box(scrim.right, scrim_color, BLANK)
Box(anchor, BLANK, GetThemeText())
arrow := GuideArrowFor(tip, anchor, metrics)
Line((int)arrow.line_start.x, (int)arrow.line_start.y,
(int)arrow.line_end.x, (int)arrow.line_end.y, GetThemeText())
Line((int)arrow.tip0.x, (int)arrow.tip0.y,
(int)arrow.tip1.x, (int)arrow.tip1.y, GetThemeText())
Line((int)arrow.tip0.x, (int)arrow.tip0.y,
(int)arrow.tip2.x, (int)arrow.tip2.y, GetThemeText())
widget_panel(tip, panel)
Text((TextProps){.text = guide.steps[step].text, .bounds = layout.text,
.font = font, .wrap = TextWrapAuto})
@@ -124,16 +148,16 @@ AppGuideOverlay :: (guide: GuideOverlayProps) -> UIGuideResult #export {
previous := IsKeyPressed(KEY_LEFT)
next := IsKeyPressed(KEY_RIGHT) || IsKeyPressed(KEY_ENTER)
close := IsKeyPressed(KEY_BACK) || IsKeyPressed(KEY_ESCAPE)
if Button((ButtonProps){.bounds = layout.close_button, .icon_type = guide.close_icon_type,
if Button((ButtonProps){.id = 83110, .bounds = layout.close_button, .icon_type = guide.close_icon_type,
.icon_only = 1, .tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft}) {
close = 1
}
if step > 0 && Button((ButtonProps){.bounds = layout.back_button,
if step > 0 && Button((ButtonProps){.id = 83111, .bounds = layout.back_button,
.icon_type = guide.back_icon_type, .icon_only = 1,
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft}) {
previous = 1
}
if Button((ButtonProps){.bounds = layout.next_button,
if Button((ButtonProps){.id = 83112, .bounds = layout.next_button,
.icon_type = layout.finish ? guide.done_icon_type : guide.next_icon_type,
.icon_only = 1, .tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft}) {
next = 1
+37 -76
View File
@@ -282,6 +282,7 @@ habits_screen_dismiss_first_run_guide :: (app: InnerBreeze*) {
habits_screen_first_run_guide_active :: (app: const InnerBreeze*) -> int {
return app != nil &&
!app->habits_guide_seen &&
app->habits.count > 0 &&
!app->modal.active &&
app->breathing.screen == ScreenHabits &&
!storage_has_sync_account()
@@ -301,77 +302,12 @@ habits_screen_prepare_first_run_guide :: (app: InnerBreeze*) {
habit_edit_cancel(app)
}
app->habits.screen_mode = HABITS_SCREEN_OVERVIEW
app->habits.selected = -1
app->habits.selected = step >= 2 && app->habits.count > 0 ? 0 : -1
app->habits.tab = HABIT_TAB_WEEKLY
app->habits.view_mode = HABIT_VIEW_WEEKLY
app->habits.scroll = 0
}
habits_cards_progress_anchor :: (app: InnerBreeze*) -> Rectangle #private {
x: int
w: int
y := habits_screen_top_reserved(app) + Scale(51)
pad := Scale(5)
progress: [64] char = {0}
GetCenteredColumn(Scale(CONTENT_MAX_W), GetPageSidePadding(),
&x, &w)
snprintf(progress, sizeof(progress),
GetLocaleText("habits_done_count_label"),
habits_done_today(app), habits_due_today(app))
return (Rectangle){(float)(x - pad), (float)(y - pad),
(float)(AppTextWidth(progress, AppSmallFontSize()) + pad * 2),
(float)(AppTextLineHeight(AppSmallFontSize()) + pad * 2)}
}
habits_cards_first_anchor :: (app: InnerBreeze*) -> Rectangle #private {
x: int
w: int
y := habits_screen_top_reserved(app) + Scale(86)
GetCenteredColumn(Scale(CONTENT_MAX_W), GetPageSidePadding(),
&x, &w)
return (Rectangle){(float)x, (float)y, (float)w,
(float)habits_focus_collapsed_height()}
}
habits_expanded_card_action_anchor :: (app: InnerBreeze*, action: int) -> Rectangle #private {
x: int
w: int
y := habits_screen_top_reserved(app) + Scale(86)
gap := Scale(8)
action_x: int
action_w: int
GetCenteredColumn(Scale(CONTENT_MAX_W), GetPageSidePadding(),
&x, &w)
action_w = (w - Scale(28) - gap * 2) / 3
action_x = x + Scale(14) + action * (action_w + gap)
return (Rectangle){
(float)action_x,
(float)(y + Scale(78)),
(float)action_w,
(float)Scale(52)
}
}
habits_expanded_card_week_anchor :: (app: InnerBreeze*) -> Rectangle #private {
x: int
w: int
y := habits_screen_top_reserved(app) + Scale(86)
section_y := y + Scale(144)
body_y := section_y + AppTextLineHeight(AppSmallFontSize()) + Scale(12)
GetCenteredColumn(Scale(CONTENT_MAX_W), GetPageSidePadding(),
&x, &w)
return (Rectangle){
(float)(x + Scale(14)),
(float)body_y,
(float)(w - Scale(28)),
(float)Scale(72)
}
}
habits_draw_fitted_text :: (text: const char*, x: int, y: int,
max_w: int, preferred: int, minimum: int,
color: Color) #private {
@@ -452,27 +388,27 @@ habits_screen_draw_first_run_guide :: (app: InnerBreeze*) {
}
steps[0] = (UIGuideStep){
habits_cards_progress_anchor(app),
app->habits_guide_anchors[0],
GetLocaleText("habits_guide_overview_progress")
}
steps[1] = (UIGuideStep){
habits_cards_first_anchor(app),
app->habits_guide_anchors[1],
GetLocaleText("habits_guide_overview_grid")
}
steps[2] = (UIGuideStep){
habits_expanded_card_action_anchor(app, 0),
app->habits_guide_anchors[2],
GetLocaleText("habits_guide_meditation_views")
}
steps[3] = (UIGuideStep){
habits_expanded_card_action_anchor(app, 1),
app->habits_guide_anchors[3],
GetLocaleText("habits_guide_meditation_statistics")
}
steps[4] = (UIGuideStep){
habits_expanded_card_action_anchor(app, 2),
app->habits_guide_anchors[4],
GetLocaleText("habits_guide_meditation_edit")
}
steps[5] = (UIGuideStep){
habits_expanded_card_week_anchor(app),
app->habits_guide_anchors[5],
GetLocaleText("habits_guide_meditation_session_data")
}
@@ -1243,6 +1179,11 @@ habits_focus_draw_week :: (app: InnerBreeze*, habit: Habit*, selected: int,
metric_gap := Scale(10)
metric_w := (w - metric_gap) / 2
columns := clampi(w / Scale(44), 5, 7)
if selected == 0 {
app->habits_guide_anchors[5] = (Rectangle){
(float)x, (float)row_y, (float)w, (float)row_h
}
}
if counting {
snprintf(today_label, sizeof(today_label), "%s %d",
@@ -1465,6 +1406,9 @@ habits_focus_draw_card :: (app: InnerBreeze*, selected: int,
})
}
actions = FlexStep(actions, action_size, action_size)
if selected == 0 {
app->habits_guide_anchors[2] = actions.item
}
if Button((ButtonProps){
.bounds = actions.item,
.icon_type = ICON_CALENDAR,
@@ -1475,6 +1419,9 @@ habits_focus_draw_card :: (app: InnerBreeze*, selected: int,
return
}
actions = FlexStep(actions, action_size, action_size)
if selected == 0 {
app->habits_guide_anchors[3] = actions.item
}
if Button((ButtonProps){
.bounds = actions.item,
.icon_type = ICON_STAT,
@@ -1485,6 +1432,9 @@ habits_focus_draw_card :: (app: InnerBreeze*, selected: int,
return
}
actions = FlexStep(actions, action_size, action_size)
if selected == 0 {
app->habits_guide_anchors[4] = actions.item
}
if Button((ButtonProps){
.bounds = actions.item,
.icon_type = ICON_EDIT,
@@ -1623,7 +1573,7 @@ habits_focus_draw_collapsed :: (app: InnerBreeze*, index: int,
}
}
}
if !app->modal.active &&
if !app->modal.active && !input_captured &&
CheckCollisionPointRec(mouse, row_bounds) &&
IsMouseButtonReleased(MOUSE_BUTTON_LEFT) {
app_block_current_click(app)
@@ -1646,6 +1596,9 @@ habits_focus_draw_collapsed :: (app: InnerBreeze*, index: int,
draw_habits_focus :: (app: InnerBreeze*, content_top: int) #private {
context := (HabitsFocusPageContext){app}
for int i = 0; i < HABITS_GUIDE_STEPS; i++ {
app->habits_guide_anchors[i] = (Rectangle){0}
}
measure_x: int
measure_w: int
content_h: int
@@ -1677,10 +1630,15 @@ draw_habits_focus :: (app: InnerBreeze*, content_top: int) #private {
})
snprintf(progress, sizeof(progress), GetLocaleText("habits_done_count_label"),
habits_done_today(app), habits_due_today(app))
progress_font := AppSmallFontSize()
app->habits_guide_anchors[0] = (Rectangle){
(float)x, (float)(y + Scale(35)),
(float)AppTextWidth(progress, progress_font),
(float)(progress_font + Scale(4))
}
Text((TextProps){
.bounds={(x), (y + Scale(35)), 0, 0},
.text=(progress),
.wrap=TextWrapNone
.bounds = app->habits_guide_anchors[0],
.font = progress_font, .text = progress, .wrap = TextWrapNone
})
if Button((ButtonProps){
.bounds = {(float)(x + w - button_w), (float)y,
@@ -1700,6 +1658,9 @@ draw_habits_focus :: (app: InnerBreeze*, content_top: int) #private {
} else {
grid = GridStep(grid, habits_focus_collapsed_height(), 1)
cell := grid.item
if i == 0 {
app->habits_guide_anchors[1] = cell
}
habits_focus_draw_collapsed(app, i, (int)cell.x, (int)cell.y, (int)cell.width)
}
}
+20 -13
View File
@@ -19,6 +19,11 @@ static scale_drag_value: int = 0
content_height :: (app: InnerBreeze*, content_w: int) -> int {
sidebar_h := 0
glow_h := 0
if style_pack_has_glow(app->style_index) {
glow_h = ui.toggle_row_height(GetLocaleText("appearance_glow_effects_label"),
content_w) + Scale(6)
}
if app_nav_desktop_rail_enabled(app) {
options: [2] SegmentOption = {
{GetLocaleText("navigation_sidebar_expanded"), false},
@@ -32,11 +37,11 @@ content_height :: (app: InnerBreeze*, content_w: int) -> int {
}
#if ANDROID {
return Scale(350) + Scale(292) + sidebar_h + Scale(80)
return Scale(350) + Scale(234) + sidebar_h + glow_h + Scale(80)
} #else_if WEB {
return Scale(366) + Scale(292) + sidebar_h
return Scale(366) + Scale(234) + sidebar_h + glow_h
} #else {
return Scale(350) + Scale(292) + sidebar_h
return Scale(350) + Scale(234) + sidebar_h + glow_h
}
}
@@ -86,10 +91,19 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*, state: SettingsThemeState*)
}) {
app->style_index = selected_style + 1
app_apply_style(app)
app->settings_scroll = 0
app_block_current_click(app)
save_settings(app)
}
*y += Scale(56)
if style_pack_has_glow(app->style_index) {
if ui.commit_toggle_row(app, x, w, y,
GetLocaleText("appearance_glow_effects_label"),
&app->lightfield_glow_enabled, 1) {
app_apply_style(app)
}
*y += Scale(6)
}
draw_scale_row(app, x, w, y)
placements: [5] const char* = {
@@ -143,15 +157,6 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*, state: SettingsThemeState*)
}
*y += Scale(24)
glow_effects := app->glow_effects_enabled
if ui.commit_toggle_row(app, x, w, y,
GetLocaleText("appearance_glow_effects_label"),
&glow_effects, 1) {
app->glow_effects_enabled = glow_effects
SetFancyEffectsEnabled(app->glow_effects_enabled)
}
*y += Scale(6)
if Button((ButtonProps){
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(44))},
.label = GetLocaleText("customize_nav_button"),
@@ -207,9 +212,11 @@ settings_screen_draw_app_icon_modal :: (app: InnerBreeze*) #export {
}
}
}
message := GetLocaleText(state->app_icon_error ? "app_icon_error" : "app_icon_hint")
Text((TextProps){
.bounds = {frame.content_x, frame.content_y + Scale(184), frame.content_w, 0},
.text = GetLocaleText(state->app_icon_error ? "app_icon_error" : "app_icon_hint")
.text = message, .wrap = TextWrapNone,
.font = AppFitFontSize(message, frame.content_w, AppSmallFontSize(), Scale(Text8))
})
} #else {
unused app
+9 -1
View File
@@ -89,6 +89,12 @@ static const char *derived_keys[] = {
NULL
};
/* Older backups can still import these keys; loading migrates their values. */
static const char *legacy_imported_keys[] = {
"glow_effects",
NULL
};
static int
key_is_whitelisted(const char *key, const char **list)
{
@@ -234,7 +240,9 @@ main(void)
}
for(int i = 0; i < imported.count; i++) {
if(!keyset_contains(&saved, imported.keys[i]) &&
!key_is_whitelisted(imported.keys[i], helper_saved_keys)) {
!key_is_whitelisted(imported.keys[i], helper_saved_keys) &&
!(key_is_whitelisted(imported.keys[i], legacy_imported_keys) &&
keyset_contains(&loaded, imported.keys[i]))) {
fprintf(stderr, "FAIL importable setting [%s] is never saved\n",
imported.keys[i]);
failures++;
+1 -1