Fixing core to work with win32 #1257
This commit is contained in:
parent
17450fde65
commit
13e53e7176
3 changed files with 8 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue