summaryrefslogtreecommitdiff
path: root/src/sdl.zig
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2021-06-30 18:28:45 +0200
committerTom Barrett <tom@tombarrett.xyz>2021-06-30 18:28:45 +0200
commit79d2aec6e835c75962ae49462dab4bea2b122720 (patch)
tree9d809af851aaa3324f0b225ffa0f99d71d4c1c57 /src/sdl.zig
parentd79befe12a8d6b32a41beb88d6e75b12a75615a7 (diff)
fixed event issue, and made it look cooler
Diffstat (limited to 'src/sdl.zig')
-rw-r--r--src/sdl.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sdl.zig b/src/sdl.zig
index d9828af..c7b9906 100644
--- a/src/sdl.zig
+++ b/src/sdl.zig
@@ -54,9 +54,13 @@ pub fn get_event() event {
_ = sdl.SDL_PollEvent(&e);
var key = keys.none;
+ if (std.meta.intToEnum(keys, e.key.keysym.sym)) |val| {
+ key = val;
+ } else |err| {}
var mode = modes.mouse;
- //var key = @intToEnum(keys, e.key.keysym.sym);
- //var mode = @intToEnum(modes, e.type);
+ if (std.meta.intToEnum(modes, e.type)) |val| {
+ mode = val;
+ } else |err| {}
var r: event = event{
.key = key,