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.
29 lines
989 B
Ziran
29 lines
989 B
Ziran
// The application frame the canonical Android host calls back each frame.
|
|
App :: #import "app_types";
|
|
#import "session"
|
|
#import "geometry"
|
|
#import "frame_snapshot"
|
|
#import "input_protocol"
|
|
#import "android_touch"
|
|
#import "paint_queue"
|
|
|
|
frames: s32;
|
|
seen: FrameInputSnapshot;
|
|
foreign_seen: bool;
|
|
foreign: Session;
|
|
pointer_matches: bool;
|
|
paint_red: u8;
|
|
|
|
Frame :: (frame: App.Frame) {
|
|
session := Session.{.slot = frame.slot, .epoch = frame.epoch}
|
|
frames += 1
|
|
seen = CaptureFrameInput(session)
|
|
first := PollPointer()
|
|
second := PollPointer()
|
|
pointer_matches = first.x == seen.pointer.x && second.x == first.x &&
|
|
first.pressed == seen.pointer.pressed && second.pressed == first.pressed &&
|
|
first.released == seen.pointer.released && second.released == first.released
|
|
if CaptureFrameInput(foreign).available { foreign_seen = true }
|
|
if paint_red != 0 { PaintRoundedFill(session, -1, .{10.0, 10.0, 12.0, 8.0}, 0.0, 0, .{paint_red, 80, 120, 255}) }
|
|
}
|