examples: use engine.core.setKeyCallback() instead of accessing glfw directly
This commit is contained in:
parent
5396769227
commit
1f95bd48df
6 changed files with 18 additions and 32 deletions
|
|
@ -40,13 +40,11 @@ bgl: gpu.BindGroupLayout,
|
|||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||
timer = try std.time.Timer.start();
|
||||
|
||||
engine.core.internal.window.setKeyCallback(struct {
|
||||
fn callback(window: glfw.Window, key: glfw.Key, scancode: i32, action: glfw.Action, mods: glfw.Mods) void {
|
||||
_ = scancode;
|
||||
_ = mods;
|
||||
engine.core.setKeyCallback(struct {
|
||||
fn callback(_: *App, eng: *mach.Engine, key: mach.Key, action: mach.Action) void {
|
||||
if (action == .press) {
|
||||
switch (key) {
|
||||
.space => window.setShouldClose(true),
|
||||
.space => eng.core.internal.window.setShouldClose(true),
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue