diff --git a/examples/core/custom-entrypoint/main.zig b/examples/core/custom-entrypoint/main.zig index 7ad46c68a9..a0a383ef1b 100644 --- a/examples/core/custom-entrypoint/main.zig +++ b/examples/core/custom-entrypoint/main.zig @@ -25,7 +25,7 @@ pub fn main() !void { // possible on all platforms. if (mach.Core.supports_non_blocking) { mach.Core.non_blocking = true; - while (mach.mods.mod.mach_core.state != .exited) { + while (mach.mods.mod.mach_core.state().state != .exited) { // Execute systems until a frame has been finished. try mach.mods.dispatchUntil(stack_space, .mach_core, .frame_finished); } diff --git a/src/Core.zig b/src/Core.zig index 8cfb2613d4..1797aaed9d 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -331,8 +331,8 @@ pub fn start(core: *Mod) !void { const stack_space = try core.state().allocator.alloc(u8, 8 * 1024 * 1024); if (supports_non_blocking) { - while (mach.mods.mod.mach_core.state != .exited) { - try mach.mods.dispatchUntil(stack_space, .mach_core, .frame_finished); + while (core.state().state != .exited) { + dispatch(stack_space); } // Don't return, because Platform.run wouldn't either (marked noreturn due to underlying // platform APIs never returning.) @@ -348,6 +348,10 @@ pub fn start(core: *Mod) !void { } } +fn dispatch(stack_space: []u8) void { + mach.mods.dispatchUntil(stack_space, .mach_core, .frame_finished) catch { @panic("Dispatch in Core failed"); }; +} + fn platform_update_callback(core: *Mod, stack_space: []u8) !bool { // Execute systems until .mach_core.frame_finished is dispatched, signalling a frame was // finished. diff --git a/src/core/win32.zig b/src/core/win32.zig index 7faadc594e..74e5ef3c68 100644 --- a/src/core/win32.zig +++ b/src/core/win32.zig @@ -130,6 +130,7 @@ pub fn init( self.border = options.border; self.headless = options.headless; self.refresh_rate = 60; // TODO (win32) get monitor refresh rate + self.vsync_mode = .triple; _ = w.SetWindowLongPtrW(window, w.GWLP_USERDATA, @bitCast(@intFromPtr(self))); if (!options.headless) {