mach: add setCursorMode (desktop only for now)

This commit is contained in:
Martin Wickham 2022-10-13 09:28:26 -05:00 committed by Stephen Gutekanst
parent 2c65845aed
commit 78dfa2df6b
5 changed files with 31 additions and 0 deletions

View file

@ -374,6 +374,15 @@ pub const Platform = struct {
}
}
pub fn setCursorMode(platform: *Platform, mode: enums.CursorMode) !void {
const glfw_mode: glfw.Window.InputModeCursor = switch (mode) {
.normal => .normal,
.hidden => .hidden,
.disabled => .disabled,
};
try platform.window.setInputModeCursor(glfw_mode);
}
pub fn hasEvent(platform: *Platform) bool {
return platform.events.first != null;
}

View file

@ -123,6 +123,10 @@ pub const Platform = struct {
js.machSetMouseCursor(cursor_name.ptr, cursor_name.len);
}
pub fn setCursorMode(_: *Platform, _: enums.CursorMode) !void {
@panic("TODO: Implement setCursorMode for wasm");
}
fn pollChanges(platform: *Platform) void {
const change_type = js.machChangeShift();