mach: wasm: Implement setShouldClose for wasm

This commit is contained in:
iddev5 2022-06-08 13:20:59 +05:30 committed by Stephen Gutekanst
parent 2d53b8bdfd
commit 772a821ce1
3 changed files with 17 additions and 3 deletions

View file

@ -13,6 +13,7 @@ const js = struct {
extern fn machCanvasGetWindowHeight(canvas: CanvasId) u32;
extern fn machCanvasGetFramebufferWidth(canvas: CanvasId) u32;
extern fn machCanvasGetFramebufferHeight(canvas: CanvasId) u32;
extern fn machEmitCloseEvent() void;
extern fn machEventShift() i32;
extern fn machEventShiftFloat() f64;
extern fn machChangeShift() u32;
@ -63,7 +64,9 @@ pub const Platform = struct {
js.machCanvasSetTitle(platform.id, title.ptr, title.len);
}
pub fn setShouldClose(_: *Platform, _: bool) void {}
pub fn setShouldClose(_: *Platform, value: bool) void {
if (value) js.machEmitCloseEvent();
}
pub fn getFramebufferSize(platform: *Platform) structs.Size {
return platform.last_framebuffer_size;