From 2440a20bb777cb5dbd3488ea7e7fe20dc1a2d805 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 17 Aug 2024 13:10:12 +0200 Subject: [PATCH] minor code cleanup, update sokol-zig --- build.zig.zon | 4 ++-- emus/bombjack/bombjack.zig | 9 +++++---- emus/namco/namco.zig | 9 +++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index a272688..e3edeb3 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -4,8 +4,8 @@ .dependencies = .{ // sokol only needed for the actual emulators .sokol = .{ - .url = "git+https://github.com/floooh/sokol-zig.git#afd2c467a6049f89edd7282749478c9bc2b57078", - .hash = "122098e53bf5cb223cde8f123d81680932d66e9ec971e99b5f20a1b7ba0a9ca7ad4c", + .url = "git+https://github.com/floooh/sokol-zig.git#9e4eabae83c74df29b24cdba7b31e985a2d8c33f", + .hash = "12209706d64fa2127cc2d48134c22790d70f561c40bdeb4589fa7f9c41c4f53fe9da", }, }, .paths = .{ diff --git a/emus/bombjack/bombjack.zig b/emus/bombjack/bombjack.zig index c341b7b..7df780e 100644 --- a/emus/bombjack/bombjack.zig +++ b/emus/bombjack/bombjack.zig @@ -75,10 +75,11 @@ fn keyToInput(key: sapp.Keycode) Bombjack.Input { }; } -export fn input(ev: [*c]const sapp.Event) void { - switch (ev.*.type) { - .KEY_DOWN => sys.setInput(keyToInput(ev.*.key_code)), - .KEY_UP => sys.clearInput(keyToInput(ev.*.key_code)), +export fn input(event: ?*const sapp.Event) void { + const ev = event.?; + switch (ev.type) { + .KEY_DOWN => sys.setInput(keyToInput(ev.key_code)), + .KEY_UP => sys.clearInput(keyToInput(ev.key_code)), else => {}, } } diff --git a/emus/namco/namco.zig b/emus/namco/namco.zig index cf77abe..b0e060c 100644 --- a/emus/namco/namco.zig +++ b/emus/namco/namco.zig @@ -97,10 +97,11 @@ fn keyToInput(key: sapp.Keycode) Namco.Input { }; } -export fn input(ev: [*c]const sapp.Event) void { - switch (ev.*.type) { - .KEY_DOWN => sys.setInput(keyToInput(ev.*.key_code)), - .KEY_UP => sys.clearInput(keyToInput(ev.*.key_code)), +export fn input(event: ?*const sapp.Event) void { + const ev = event.?; + switch (ev.type) { + .KEY_DOWN => sys.setInput(keyToInput(ev.key_code)), + .KEY_UP => sys.clearInput(keyToInput(ev.key_code)), else => {}, } }