Files
waozi 09664f076d Remove the program-export program entry; main is the only entry
main is the only program entry. Frame stays an ordinary function that apps pass to App.Run; the frame-entry export mechanism (frame_entry, ProjectFrame binds, KRYON_FRAME_ENTRY, *_run.zi hosts) is gone. The pixmap, dom, terminal, zx and android frame loops are now frames_*.zi modules that App.Run selects. Consumer tests and fixtures build their own shot programs through the kryon package exports, and the desktop project probe imports Window explicitly. General #program_export component exports stay.
2026-11-25 05:56:17 -03:00

36 lines
1.4 KiB
Ziran

App :: #import "kryon/app";
LoadingIndicator :: #import "kryon/loading_indicator";
Text :: #import "kryon/text";
Layout :: #import "kryon/layout";
#import "kryon/tree"
#import "kryon/geometry"
#import "kryon/session"
#import "kryon/frame_snapshot"
DemoTheme :: #import "kryon/Theme";
Frame :: (frame: App.Frame) {
session := Session.{.slot = frame.slot, .epoch = frame.epoch}
viewport := frame.viewport
page := Layout.Draw(session, Layout.Props.{.bounds = viewport, .padding = Layout.Gap(.ThemeMetricSpace5),
.gap = Layout.Gap(.ThemeMetricSpace4), .gap_override = true})
if !page.opened { return }
Text.Draw(session, Text.Props.{.disabled = example_disabled, .bounds = .{height = 40}, .text = "Loading indicator", .size = 28})
input := CaptureFrameInput(session)
now := cast(float64)input.elapsed_ms / 1000.0
LoadingIndicator.Draw(session, LoadingIndicator.Props.{.bounds = .{height = 180}, .now = ifx (example_reduced_motion || DemoTheme.CurrentTheme().motion.reduced_motion) then 0.0 else now, .scale = 1.0})
unused End(session)
return
}
example_disabled: bool;
example_reduced_motion: bool;
// The gallery host calls this before drawing the example's frames.
SetExampleOptions :: (disabled: bool, reduced_motion: bool) {
example_disabled = disabled
example_reduced_motion = reduced_motion
}
main :: () -> s32 { return App.Run(App.Window.{.title = "loading"}, Frame) }