From 79d2aec6e835c75962ae49462dab4bea2b122720 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Wed, 30 Jun 2021 18:28:45 +0200 Subject: fixed event issue, and made it look cooler --- src/sdl.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/sdl.zig') 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, -- cgit v1.2.3