Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const c = @import("c.zig");
- pub const Key = enum {
- const Self = @This();
- Up,
- Down,
- Left,
- Right,
- Escape,
- pub fn fromGLFW(key: c_int) ?Key {
- return switch (key) {
- c.GLFW_KEY_ESCAPE => .Escape,
- c.GLFW_KEY_UP => .Up,
- c.GLFW_KEY_DOWN => .Down,
- c.GLFW_KEY_LEFT => .Left,
- c.GLFW_KEY_RIGHT => .Right,
- else => null,
- };
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment