parent
308d413f09
commit
15dfb2867a
15 changed files with 21 additions and 21 deletions
|
|
@ -22,8 +22,8 @@ pub fn update(_: *App, _: *Core) !void {}
|
|||
// 2. Core might need to expose more state so more API functions can be exposed (for example, the WebGPU API)
|
||||
// 3. Be very careful about arguments, types, memory, etc - any mismatch will result in undefined behavior
|
||||
|
||||
pub export fn mach_core_set_should_close(core: *Core) void {
|
||||
core.setShouldClose(true);
|
||||
pub export fn mach_core_close(core: *Core) void {
|
||||
core.close();
|
||||
}
|
||||
|
||||
pub export fn mach_core_delta_time(core: *Core) f32 {
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ pub const Platform = struct {
|
|||
if (options.headless) platform.window.hide() catch {};
|
||||
}
|
||||
|
||||
pub fn setShouldClose(platform: *Platform, value: bool) void {
|
||||
platform.window.setShouldClose(value);
|
||||
pub fn close(platform: *Platform) void {
|
||||
platform.window.setShouldClose(true);
|
||||
}
|
||||
|
||||
pub fn getFramebufferSize(platform: *Platform) structs.Size {
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ pub const Platform = struct {
|
|||
js.machCanvasSetFullscreen(platform.id, options.fullscreen);
|
||||
}
|
||||
|
||||
pub fn setShouldClose(_: *Platform, value: bool) void {
|
||||
if (value) js.machEmitCloseEvent();
|
||||
pub fn close(_: *Platform) void {
|
||||
js.machEmitCloseEvent();
|
||||
}
|
||||
|
||||
pub fn setWaitEvent(_: *Platform, timeout: f64) void {
|
||||
|
|
@ -297,7 +297,7 @@ export fn wasmUpdate() void {
|
|||
core.delta_time_ns = core.timer.lapPrecise();
|
||||
core.delta_time = @intToFloat(f32, core.delta_time_ns) / @intToFloat(f32, std.time.ns_per_s);
|
||||
|
||||
app.update(&core) catch core.setShouldClose(true);
|
||||
app.update(&core) catch core.close();
|
||||
}
|
||||
|
||||
export fn wasmDeinit() void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue