Pin only pushed commits, with no local overrides: Ziran v0.5.0 (f9f92b46), Kryon b45cc524 (one lock entry, ref master, shared with the Css and Plot master edges), Apps 352901e, Entity b30dd4a and practices 893e5b6f, whose sharpened banners and regenerated Lumi guide clips the narration check now matches. The Library opens each Tao Te Ching chapter on its own picture page: the chapter art and its title, centered together; the text pages follow. The reader keeps the picture page across reflow, and a chapter start or a Contents pick opens it. The 81 approved chapter pictures are included. Breeze now uses Kryon's namespaced widgets (Text.Draw/Text.Props, Button, Image, Modal.ActionModal, Layout, TabBar, LoadingScreen, LoadingIndicator, Shape.Circle) instead of the removed Kryon/Widgets facades. Hosted apps import std/text explicitly, since a short "text" import now names Kryon's widget. AGENTS.md and the Text/Button API checks describe the namespaced forms; two unused test doubles are removed. Build fixes for the new toolchain: the bundle runtime carries Ziran's instruction engine (no BOOTSTRAP=1) and takes the pinned host zi2c for cross builds; the Apps controller's lock context has the manifest's module roots; the app codec generator lists Kryon's raw modules only; the package scripts read ZX revision 28 bundle assets. The Apps controller digest matches the Apps 352901e build. Also included: the stopped lanes' work in this tree (Radio download, Photos install, Lists, Lumi, Habits shop rewards, astral exercise selection, appearance and download recovery) and the raylib-free desktop lane's host modules (app_trace, host_input, host_window, host_clock), inactive unless DESKTOP_HOST is defined. Not included: the crash-recovery lane's picture-window and storage crash-safety changes, which that lane commits itself. Local tests: zi-check (510 modules), native and Android source checks, hosted app checks, build-laws, clean-text-api-check, button-api-check, library-reader-test, library-ui-test, storage-crash-zi-test and native-image-decode-test pass. The bundled Arcade is still ZX revision 26 and waits for an Arcade build on these pins.
418 lines
20 KiB
Ziran
418 lines
20 KiB
Ziran
#import "session"
|
|
#import "geometry"
|
|
#import "dpi"
|
|
Box :: #import "kryon/box";
|
|
Button :: #import "kryon/button";
|
|
Image :: #import "kryon/image";
|
|
Layout :: #import "kryon/layout";
|
|
Progress :: #import "kryon/progress";
|
|
Scroll :: #import "kryon/scroll";
|
|
SegmentedControl :: #import "kryon/segmented_control";
|
|
Shape :: #import "kryon/shape";
|
|
Text :: #import "kryon/text";
|
|
Toolbar :: #import "kryon/toolbar";
|
|
#import "kryon/system_clipboard"
|
|
#import "vec"
|
|
#import "drawing_props"
|
|
#import "text_align"
|
|
#import "text_measure"
|
|
#import "control_props"
|
|
#import "kryon/tree"
|
|
#import, file "../../src/apps/practice_ui_types.zi";
|
|
#import, file "../../src/apps/practice_types.zi";
|
|
#import, file "../../src/app/exercise_types.zi";
|
|
#import, file "workout_rules.zi";
|
|
#import, file "../../src/practices/sun_salutation/sun_salutation_rules.zi";
|
|
#import, file "figure_view.zi";
|
|
|
|
using ExerciseType;
|
|
using TextAlign;
|
|
using Text.Wrap;
|
|
using ButtonTone;
|
|
using ButtonEmphasis;
|
|
host_api :: #system_library "host_api";
|
|
ReadPracticeMovementHost :: () -> PracticeMovementFrame #foreign host_api;
|
|
WritePracticeMovementHost :: (frame: PracticeMovementFrame) #foreign host_api;
|
|
MovementLocaleHost :: (key: string) -> string #foreign host_api;
|
|
movement: PracticeMovementFrame;
|
|
|
|
Scale :: (pixels: s32) -> s32 {
|
|
return ScalePixels(pixels, movement.scale)
|
|
}
|
|
|
|
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
|
|
return Rectangle.{cast(float32)x, cast(float32)y, cast(float32)width, cast(float32)height}
|
|
}
|
|
|
|
Locale :: (key: string) -> string {
|
|
return MovementLocaleHost(key)
|
|
}
|
|
|
|
Alpha :: (color: Color, opacity: float32) -> Color {
|
|
color.a = cast(u8)(cast(float32)color.a * opacity)
|
|
return color
|
|
}
|
|
|
|
ParagraphHeight :: (text: string, width: s32, font: s32, gap: s32 = 0) -> s32 {
|
|
return TextHeight(movement.session, Text.Props.{.text = text, .size = font,
|
|
.bounds = Bounds(0, 0, width, 0), .line_gap = gap, .wrap = cast(Text.Wrap)TextWrapAuto})
|
|
}
|
|
|
|
Figure :: (bounds: Rectangle, key: string, alt: string) {
|
|
PracticeFigure(PracticeFigureRequest.{.practice = movement.practice,
|
|
.bounds = bounds, .key = Layout.KeyHash(key), .alt_text = alt})
|
|
}
|
|
|
|
// The same three 44-unit targets and bottom-row geometry as the host used.
|
|
Controls :: () -> s32 {
|
|
layout := Toolbar.BottomIconRowLayoutFor(Toolbar.BottomIconRowProps.{
|
|
.center_x = movement.view_width / 2, .view_width = movement.view_width,
|
|
.view_height = movement.view_height, .count = 3}, movement.scale)
|
|
labels: [3]string = .[Locale("back_button"),
|
|
Locale(ifx movement.paused then "play_button" else "pause_button"), Locale("next_button")]
|
|
sources: [3]Rectangle = .[Rectangle.{128, 0, 64, 64},
|
|
Rectangle.{ifx movement.paused then 256.0 else 64.0, 192, 64, 64}, Rectangle.{128, 64, 64, 64}]
|
|
for index: cast(s32)0..2 {
|
|
if Button.Draw(movement.session, Button.Props.{.id = 83000 + index,
|
|
.bounds = Toolbar.BottomIconRowButtonBoundsFor(layout, index), .label = labels[index],
|
|
.icon_only = true, .image = Image.Props.{.asset_path = "icons/ui.webp",
|
|
.source = sources[index], .alt_text = labels[index]},
|
|
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
|
.disabled = index == 0 && !movement.can_back}) != 0 {
|
|
movement.action = index + 1
|
|
}
|
|
}
|
|
return layout.y
|
|
}
|
|
|
|
CenteredLine :: (text: string, y: s32, preferred: s32, minimum: s32, strong: bool) -> s32 {
|
|
font := preferred
|
|
if TextWidth(movement.session, Text.Props.{.text = text, .size = font}) > movement.view_width - Scale(80) {
|
|
font = minimum
|
|
}
|
|
emphasis: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)text.count}]
|
|
Text.Draw(movement.session, Text.Props.{.text = text,
|
|
.bounds = Bounds(0, y, movement.view_width, 0), .size = font,
|
|
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapNone,
|
|
.strong = ifx strong then emphasis[:1] else emphasis[:0]})
|
|
return y + TextHeight(movement.session, Text.Props.{.text = "M", .size = font})
|
|
}
|
|
|
|
// The name of the step that follows, as one quiet line across the bottom of
|
|
// the stage; returns the stage left for the moving figure.
|
|
SunSalutationNext :: (stage: Rectangle, step: s32) -> Rectangle {
|
|
joined: Vec(u8)
|
|
BuilderPrint(*joined, "% ·", Locale("sun_salutation_next"))
|
|
label := BuilderFinish(joined)
|
|
name := Locale(SalutationStepKey(step))
|
|
font := Scale(16)
|
|
emphasis: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)name.count}]
|
|
line_h := TextHeight(movement.session, Text.Props.{.text = "M", .size = font})
|
|
if cast(s32)stage.height - line_h < Scale(160) {
|
|
return stage
|
|
}
|
|
// A word space between "Next ·" and the pose name.
|
|
space := Scale(5)
|
|
available := cast(s32)stage.width - Scale(32) - space
|
|
label_w := TextWidth(movement.session, Text.Props.{.text = label, .size = font})
|
|
name_w := TextWidth(movement.session,
|
|
Text.Props.{.text = name, .size = font, .strong = emphasis[:1]})
|
|
if label_w + name_w > available {
|
|
font = Scale(14)
|
|
line_h = TextHeight(movement.session, Text.Props.{.text = "M", .size = font})
|
|
label_w = TextWidth(movement.session, Text.Props.{.text = label, .size = font})
|
|
name_w = TextWidth(movement.session,
|
|
Text.Props.{.text = name, .size = font, .strong = emphasis[:1]})
|
|
}
|
|
if label_w + name_w > available && name_w > available - label_w {
|
|
if label_w > available {
|
|
label_w = available
|
|
}
|
|
name_w = available - label_w
|
|
}
|
|
line_w := label_w + space + name_w
|
|
line_x := cast(s32)stage.x + (cast(s32)stage.width - line_w) / 2
|
|
line_y := cast(s32)(stage.y + stage.height) - line_h
|
|
Text.Draw(movement.session, Text.Props.{.text = label, .bounds = Bounds(line_x, line_y, label_w, line_h),
|
|
.size = font, .class_name = movement.muted_class, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
|
Text.Draw(movement.session, Text.Props.{.text = name, .bounds = Bounds(line_x + label_w + space, line_y, name_w, line_h),
|
|
.size = font, .strong = emphasis[:1], .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
|
stage.height -= cast(float32)(line_h + Scale(8))
|
|
return stage
|
|
}
|
|
|
|
// The pose and how to hold it, the leg that is back in a lunge, the breath
|
|
// with its bar, the moving figure and the pose that comes next.
|
|
SunSalutation :: () {
|
|
bottom := Controls() - Scale(18)
|
|
y := CenteredLine(movement.heading, movement.top + Scale(18), Scale(24), Scale(20), true)
|
|
text_w := movement.view_width - Scale(48)
|
|
if text_w > Scale(560) {
|
|
text_w = Scale(560)
|
|
}
|
|
if movement.subtitle.count > 0 {
|
|
cue_h := ParagraphHeight(movement.subtitle, text_w, Scale(16))
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.subtitle,
|
|
.bounds = Bounds((movement.view_width - text_w) / 2, y + Scale(2), text_w, cue_h),
|
|
.size = Scale(16), .class_name = movement.muted_class,
|
|
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapAuto})
|
|
y += Scale(2) + cue_h
|
|
}
|
|
side := SalutationSideKey(movement.phase)
|
|
if side.count > 0 {
|
|
y = CenteredLine(Locale(side), y + Scale(4), Scale(18), Scale(16), true)
|
|
}
|
|
y = CenteredLine(movement.cue, y + Scale(6), Scale(20), Scale(18), false)
|
|
width := movement.view_width - Scale(96)
|
|
if width > Scale(280) {
|
|
width = Scale(280)
|
|
}
|
|
y += Scale(8)
|
|
Progress.Draw(movement.session, Progress.Props.{.bounds = Bounds((movement.view_width - width) / 2,
|
|
y, width, Scale(10)), .min = 0, .max = 1000, .value = movement.progress})
|
|
y += Scale(22)
|
|
stage := Bounds(Scale(24), y, movement.view_width - Scale(48), bottom - y)
|
|
if movement.exercise > 0 {
|
|
stage = SunSalutationNext(stage, movement.exercise - 1)
|
|
}
|
|
Figure(stage, "sun-salutation/figure", Locale("exercise_sun_salutation"))
|
|
}
|
|
|
|
TaiChi :: () {
|
|
row_y := Controls()
|
|
y := movement.top + Scale(12)
|
|
if movement.subtitle.count > 0 {
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.subtitle,
|
|
.bounds = Bounds(Scale(24), y, movement.view_width - Scale(48), 0),
|
|
.size = Scale(16), .class_name = movement.muted_class,
|
|
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
|
y += TextHeight(movement.session, Text.Props.{.text = "M", .size = Scale(16)}) + Scale(4)
|
|
}
|
|
cue_height := TextHeight(movement.session, Text.Props.{.text = "M", .size = Scale(20)}) * 2
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.cue,
|
|
.bounds = Bounds(Scale(24), y, movement.view_width - Scale(48), cue_height),
|
|
.size = Scale(20), .align = cast(TextAlign)TextAlignCenter})
|
|
y += cue_height + Scale(8)
|
|
progress_y := row_y - Scale(22)
|
|
width := movement.view_width - Scale(96)
|
|
if width > Scale(420) {
|
|
width = Scale(420)
|
|
}
|
|
Progress.Draw(movement.session, Progress.Props.{.key = Layout.KeyHash("inbe/practices/tai_chi/progress"),
|
|
.bounds = Bounds((movement.view_width - width) / 2, progress_y, width, Scale(10)),
|
|
.min = 0, .max = 1000, .value = movement.progress})
|
|
angle_y := progress_y - Scale(52)
|
|
width = movement.view_width - Scale(48)
|
|
if width > Scale(440) {
|
|
width = Scale(440)
|
|
}
|
|
options: [4]SegmentedControl.SegmentOption = .[SegmentedControl.SegmentOption.{.label = Locale("tai_chi_view_front")},
|
|
SegmentedControl.SegmentOption.{.label = Locale("tai_chi_view_back")}, SegmentedControl.SegmentOption.{.label = Locale("tai_chi_view_side")},
|
|
SegmentedControl.SegmentOption.{.label = Locale("tai_chi_view_angled")}]
|
|
choice := SegmentedControl.Draw(movement.session, SegmentedControl.Props.{
|
|
.key = Layout.KeyHash("inbe/practices/tai_chi/angle"), .bounds = Bounds((movement.view_width - width) / 2,
|
|
angle_y, width, Scale(40)), .height = Scale(40), .selected_index = movement.view,
|
|
.has_selection = true}, options[:])
|
|
if choice.changed {
|
|
movement.action = PRACTICE_MOVEMENT_VIEWPOINT
|
|
movement.value = choice.selected_index
|
|
}
|
|
Figure(Bounds(Scale(12), y, movement.view_width - Scale(24), angle_y - Scale(12) - y),
|
|
"inbe/practices/tai_chi/figure", Locale("exercise_tai_chi"))
|
|
}
|
|
|
|
Pause :: (x: s32, y: s32, width: s32) {
|
|
if Button.Draw(movement.session, Button.Props.{
|
|
.key = Layout.KeyHash(ifx movement.practice == EXERCISE_WORKOUT then "workout/pause" else "astral/pause"),
|
|
.label = Locale(ifx movement.paused then "patterns_resume_button" else "pause_button"),
|
|
.bounds = Bounds(x, y, width, Scale(48)), .tone = cast(ButtonTone)ButtonToneAccent,
|
|
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
|
movement.action = PRACTICE_MOVEMENT_PAUSE
|
|
}
|
|
}
|
|
|
|
Astral :: () {
|
|
pad := Scale(24)
|
|
width := movement.view_width - pad * 2
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.time,
|
|
.bounds = Bounds(pad, movement.top + Scale(12), width, Scale(48)),
|
|
.size = Scale(28), .align = cast(TextAlign)TextAlignCenter})
|
|
Progress.Draw(movement.session, Progress.Props.{.key = Layout.KeyHash("astral/progress"),
|
|
.bounds = Bounds(pad, movement.top + Scale(64), width, Scale(8)),
|
|
.min = 0, .max = 1000, .value = movement.progress})
|
|
y := movement.top + Scale(84)
|
|
button_y := movement.view_height - Scale(76)
|
|
height := button_y - y - Scale(16)
|
|
if height < Scale(40) {
|
|
height = Scale(40)
|
|
}
|
|
if height >= Scale(160) {
|
|
scene_height := height * 48 / 100
|
|
Figure(Bounds(pad, y, width, scene_height), "astral/scene", Locale("exercise_astral_projection"))
|
|
y += scene_height + Scale(12)
|
|
height -= scene_height + Scale(12)
|
|
}
|
|
text_h := ParagraphHeight(movement.cue, width, movement.font)
|
|
scrolled := Scroll.Draw(movement.session, Scroll.Props.{.key = Layout.KeyHash("astral/guidance"),
|
|
.bounds = Bounds(pad, y, width, height), .content_height = text_h, .scroll_offset = movement.scroll})
|
|
movement.scroll = scrolled.scroll_offset
|
|
if scrolled.opened {
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.cue,
|
|
.bounds = Rectangle.{scrolled.content.x, scrolled.content.y, cast(float32)width, cast(float32)text_h},
|
|
.size = movement.font, .align = cast(TextAlign)TextAlignCenter})
|
|
unused End(movement.session)
|
|
}
|
|
button_w := Scale(220)
|
|
if button_w > width {
|
|
button_w = width
|
|
}
|
|
Pause((movement.view_width - button_w) / 2, button_y, button_w)
|
|
}
|
|
|
|
WorkoutProgress :: (x: s32, y: s32, width: s32) {
|
|
gap := Scale(4)
|
|
bar_w := (width - gap * (WORKOUT_EXERCISE_COUNT - 1)) / WORKOUT_EXERCISE_COUNT
|
|
bar_h := Scale(6)
|
|
for index: cast(s32)0..WORKOUT_EXERCISE_COUNT - 1 {
|
|
bar := Bounds(x + index * (bar_w + gap), y, bar_w, bar_h)
|
|
Box.Draw(movement.session, Box.Props.{.bounds = bar, .fill = Alpha(movement.text_color, 0.14),
|
|
.radius = cast(float32)bar_h / 2.0})
|
|
share: float32 = 0.0
|
|
if index < movement.exercise || movement.phase == WORKOUT_PHASE_DONE {
|
|
share = 1.0
|
|
} else if index == movement.exercise && movement.phase == WORKOUT_PHASE_WORK && movement.length_ms > 0 {
|
|
share = cast(float32)movement.elapsed_ms / cast(float32)movement.length_ms
|
|
} else if index == movement.exercise {
|
|
// The exercise being got ready for is tinted.
|
|
Box.Draw(movement.session, Box.Props.{.bounds = bar, .fill = Alpha(movement.accent_color, 0.35),
|
|
.radius = cast(float32)bar_h / 2.0})
|
|
}
|
|
if share > 0.0 {
|
|
bar.width *= share
|
|
if bar.width < cast(float32)bar_h {
|
|
bar.width = cast(float32)bar_h
|
|
}
|
|
Box.Draw(movement.session, Box.Props.{.bounds = bar, .fill = movement.accent_color,
|
|
.radius = cast(float32)bar_h / 2.0})
|
|
}
|
|
}
|
|
}
|
|
|
|
// While getting ready or resting, the seconds left as a large plain number,
|
|
// then "Go!" as the exercise starts.
|
|
WorkoutCountdownNumber :: (center: Vector2, radius: float32, count: s32) {
|
|
text := Locale("workout_go")
|
|
if count != WORKOUT_COUNT_GO {
|
|
number: Vec(u8)
|
|
BuilderPrint(*number, "%", count)
|
|
text = BuilderFinish(number)
|
|
}
|
|
emphasis: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)text.count}]
|
|
Text.Draw(movement.session, Text.Props.{.text = text,
|
|
.bounds = Rectangle.{center.x - radius * 2.0, center.y - radius, radius * 4.0, radius * 2.0},
|
|
.size = Scale(64), .align = cast(TextAlign)TextAlignCenter,
|
|
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapNone,
|
|
.strong = emphasis[:1]})
|
|
}
|
|
|
|
// The exercise's seconds left in a ring.
|
|
WorkoutCountdown :: (center: Vector2, radius: float32) {
|
|
count := WorkoutCountdownAt(WorkoutStep.{.phase = movement.phase, .exercise = movement.exercise,
|
|
.elapsed_ms = movement.elapsed_ms, .length_ms = movement.length_ms})
|
|
if count != WORKOUT_COUNT_NONE {
|
|
WorkoutCountdownNumber(center, radius, count)
|
|
return
|
|
}
|
|
thickness := cast(float32)Scale(6)
|
|
Shape.Ring(movement.session, Shape.RingProps.{.center = center, .inner_radius = radius - thickness,
|
|
.outer_radius = radius, .start_angle = 0.0, .end_angle = 360.0,
|
|
.color = Alpha(movement.text_color, 0.12)})
|
|
left: float32 = 1.0
|
|
if movement.length_ms > 0 {
|
|
left -= cast(float32)movement.elapsed_ms / cast(float32)movement.length_ms
|
|
}
|
|
if left > 0.0 {
|
|
Shape.Ring(movement.session, Shape.RingProps.{.center = center, .inner_radius = radius - thickness,
|
|
.outer_radius = radius, .start_angle = -90.0, .end_angle = -90.0 + 360.0 * left,
|
|
.color = movement.accent_color})
|
|
}
|
|
number: Vec(u8)
|
|
BuilderPrint(*number, "%", movement.seconds_left)
|
|
Text.Draw(movement.session, Text.Props.{.text = BuilderFinish(number),
|
|
.bounds = Rectangle.{center.x - radius, center.y - radius, radius * 2.0, radius * 2.0},
|
|
.size = Scale(30), .align = cast(TextAlign)TextAlignCenter,
|
|
.vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapNone})
|
|
}
|
|
|
|
Workout :: () {
|
|
pad := Scale(20)
|
|
wide := movement.view_width >= Scale(760) && movement.view_width * 10 >= movement.view_height * 12
|
|
panel_w := ifx wide then movement.view_width * 2 / 5 else movement.view_width - pad * 2
|
|
if panel_w > Scale(560) {
|
|
panel_w = Scale(560)
|
|
}
|
|
panel_x := ifx wide then movement.view_width - pad - panel_w else pad
|
|
progress_y := movement.top + Scale(10)
|
|
WorkoutProgress(pad, progress_y, movement.view_width - pad * 2)
|
|
heading_h := ParagraphHeight(movement.heading, panel_w, Scale(26))
|
|
sub_h := ParagraphHeight(movement.subtitle, panel_w, movement.font)
|
|
tip_h := ParagraphHeight(movement.cue, panel_w, movement.font, Scale(3))
|
|
content_top := progress_y + Scale(20)
|
|
words_h := heading_h + Scale(4) + sub_h
|
|
ring_r := Scale(44)
|
|
lower_h := tip_h + Scale(16) + ring_r * 2 + Scale(16 + 48 + 20)
|
|
panel_top := content_top
|
|
stage: Rectangle
|
|
if wide {
|
|
stage = Bounds(pad, content_top, panel_x - pad * 2, movement.view_height - content_top - pad)
|
|
panel_top = content_top + (movement.view_height - content_top - pad - words_h - Scale(24) - lower_h) / 2
|
|
if panel_top < content_top {
|
|
panel_top = content_top
|
|
}
|
|
} else {
|
|
stage = Bounds(pad, content_top + words_h + Scale(8), movement.view_width - pad * 2,
|
|
movement.view_height - content_top - words_h - Scale(12) - lower_h)
|
|
}
|
|
emphasis: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)movement.heading.count}]
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.heading,
|
|
.bounds = Bounds(panel_x, panel_top, panel_w, heading_h), .size = Scale(26),
|
|
.align = cast(TextAlign)TextAlignCenter, .strong = emphasis[:1]})
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.subtitle,
|
|
.bounds = Bounds(panel_x, panel_top + heading_h + Scale(4), panel_w, sub_h),
|
|
.size = movement.font, .align = cast(TextAlign)TextAlignCenter, .disabled = true})
|
|
if stage.height > cast(float32)Scale(60) {
|
|
Figure(stage, "workout/figure", movement.heading)
|
|
}
|
|
lower_y := ifx wide then panel_top + words_h + Scale(24) else movement.view_height - lower_h
|
|
Text.Draw(movement.session, Text.Props.{.text = movement.cue, .bounds = Bounds(panel_x, lower_y, panel_w, tip_h),
|
|
.size = movement.font, .align = cast(TextAlign)TextAlignCenter})
|
|
WorkoutCountdown(Vector2.{cast(float32)(panel_x + panel_w / 2),
|
|
cast(float32)(lower_y + tip_h + Scale(16) + ring_r)}, cast(float32)ring_r)
|
|
width := Scale(220)
|
|
if width > panel_w {
|
|
width = panel_w
|
|
}
|
|
Pause(panel_x + (panel_w - width) / 2, lower_y + tip_h + Scale(16) + ring_r * 2 + Scale(16), width)
|
|
}
|
|
|
|
PracticeMovementView :: (message: PracticeMessage) -> PracticeMessage {
|
|
movement = ReadPracticeMovementHost()
|
|
movement.action = PRACTICE_MOVEMENT_NONE
|
|
movement.value = 0
|
|
if movement.practice == EXERCISE_SUN_SALUTATION {
|
|
SunSalutation()
|
|
} else if movement.practice == EXERCISE_TAI_CHI {
|
|
TaiChi()
|
|
} else if movement.practice == EXERCISE_ASTRAL_PROJECTION {
|
|
Astral()
|
|
} else if movement.practice == EXERCISE_WORKOUT {
|
|
Workout()
|
|
} else {
|
|
message.succeeded = false
|
|
return message
|
|
}
|
|
WritePracticeMovementHost(movement)
|
|
message.succeeded = true
|
|
return message
|
|
}
|