Files
kryon/examples/25_inbe_practice.kry
T
waozi f4fefc7264 examples: practice config screen cartridge (sliders, spinboxes)
Wim Hof config: rounds/breaths sliders with bound counters,
retention/recovery spinboxes, the breath ring preview, and the start
button — the CONTROL range-widget class in a real screen. Seven
exactness screens now byte-identical kry_sw == SDL.
2026-08-16 23:15:45 -03:00

43 lines
2.1 KiB
Plaintext

#import "kryon.h"
# Declarative port of inbe's practice config screen (Wim Hof tab):
# sliders and spinboxes for rounds/breaths/hold, the pattern preview,
# and the start button — exercising the CONTROL node range widgets.
state {
rounds: int = 3
breaths: int = 30
hold: int = 60
recovery: int = 15
}
app "Inner Breeze — Practice" {
size 480 640
fps 60
frame main
}
frame main {
BeginDrawing()
ClearBackground(GetThemeBackground())
BeginUIFrame(GetScreenWidth(), GetScreenHeight(), GetUIScale())
Background(GetThemeSurface())
Text("Wim Hof", ScaleUIPx(70), ScaleUIPx(28), UI_TEXT_24, GetThemeText())
Text("Rounds", ScaleUIPx(40), ScaleUIPx(100), UI_TEXT_16, GetThemeText())
TextFormat("x%d", rounds, ScaleUIPx(380), ScaleUIPx(100), UI_TEXT_16, GetThemeIcon())
Slider(1, ScaleUIPx(40), ScaleUIPx(126), ScaleUIPx(340), "Rounds", 1, 10, &rounds)
Text("Breaths per round", ScaleUIPx(40), ScaleUIPx(190), UI_TEXT_16, GetThemeText())
TextFormat("%d", breaths, ScaleUIPx(380), ScaleUIPx(190), UI_TEXT_16, GetThemeIcon())
Slider(2, ScaleUIPx(40), ScaleUIPx(216), ScaleUIPx(340), "Breaths", 20, 50, &breaths)
Text("Retention hold (s)", ScaleUIPx(40), ScaleUIPx(280), UI_TEXT_16, GetThemeText())
Spinbox(3, ScaleUIPx(40), ScaleUIPx(306), ScaleUIPx(160), ScaleUIPx(12), ScaleUIPx(240), 30, 120, 5, &hold)
Text("Recovery (s)", ScaleUIPx(40), ScaleUIPx(380), UI_TEXT_16, GetThemeText())
Spinbox(4, ScaleUIPx(40), ScaleUIPx(406), ScaleUIPx(160), ScaleUIPx(12), ScaleUIPx(240), 10, 30, 5, &recovery)
DrawCircleV((Vector2){ScaleUIPx(240), ScaleUIPx(520)}, ScaleUIPx(46), (Color){0x2d, 0x4d, 0x7b, 0xff})
DrawRing((Vector2){ScaleUIPx(240), ScaleUIPx(520)}, ScaleUIPx(52), ScaleUIPx(60), 0.0f, 360.0f, 0, (Color){0x70, 0x90, 0xc0, 0xff})
Text("Start", ScaleUIPx(225), ScaleUIPx(510), UI_TEXT_16, GetThemeText())
Button((ButtonProps){"Begin practice", (Rectangle){ScaleUIPx(140), ScaleUIPx(590), ScaleUIPx(200), ScaleUIPx(40)}, (Rectangle){0,0,0,0}, (Vector2){0,0}, 0.0f, WHITE, 0}, "start")
EndUIFocus()
EndDrawing()
}