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.
This commit is contained in:
1 parent
b04ae8b68b
commit
09664f076d
184 files changed
+2231
-1763
No files matched your search
@@ -1,3 +1,4 @@
|
||||
App :: #import "kryon/app";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
@@ -69,14 +70,15 @@ Prepare :: (session: Session, scene: s32) {
|
||||
bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 208.0})
|
||||
}
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Frame :: (frame: App.Frame) {
|
||||
session := Session.{.slot = frame.slot, .epoch = frame.epoch}
|
||||
viewport := frame.viewport
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box.Draw(session, Box.Props.{.bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
page := Layout.Draw(session, Layout.Props.{.bounds = viewport, .padding = Layout.Gap(.ThemeMetricSpace6),
|
||||
.gap = Layout.Gap(.ThemeMetricSpace4), .gap_override = true})
|
||||
if !page.opened { return 0 }
|
||||
if !page.opened { return }
|
||||
Text.Draw(session, Text.Props.{.bounds = .{height = 36}, .text = "Plot · bars", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 1
|
||||
@@ -84,15 +86,16 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Prepare(session, scene)
|
||||
unused Plot.Plot(session, Plot.PlotProps.{.bounds = bounds, .semantic_label = "Eight example values", .scale_min = 0.0, .scale_max = 12.0, .mode = cast(Plot.PlotMode)scene}, values[:])
|
||||
unused End(session)
|
||||
return 0
|
||||
return
|
||||
}
|
||||
|
||||
example_disabled: bool;
|
||||
example_reduced_motion: bool;
|
||||
|
||||
// Hosts publish these options before the unchanged application entry point.
|
||||
#program_export
|
||||
// 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 = "plotbars"}, Frame) }
|
||||
Reference in new issue
Block a user