module: remove dispatchNoError, better loop implementation

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-06 11:15:40 -07:00 committed by Stephen Gutekanst
parent 5737c62171
commit af3c1e9155
6 changed files with 95 additions and 42 deletions

View file

@ -115,7 +115,6 @@ fn init(
text_mod.send(.init_pipeline, .{Text.PipelineOptions{
.pipeline = @intFromEnum(Pipeline.default),
}});
engine.dispatchNoError(); // TODO: no dispatch in user code
game.init(.{
.timer = try mach.Timer.start(),
@ -240,7 +239,7 @@ fn tick(
engine.send(.begin_pass, .{gpu.Color{ .r = 1.0, .g = 1.0, .b = 1.0, .a = 1.0 }});
text_mod.send(.render, .{@intFromEnum(Pipeline.default)});
engine.send(.end_pass, .{});
engine.send(.present, .{}); // Present the frame
engine.send(.frame_done, .{}); // Present the frame
// Every second, update the window title with the FPS
if (game.state().fps_timer.read() >= 1.0) {