Guest User

Untitled

a guest
Jul 8th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const c = @import("c.zig");
  2.  
  3. pub const Key = enum {
  4. const Self = @This();
  5.  
  6. Up,
  7. Down,
  8. Left,
  9. Right,
  10. Escape,
  11.  
  12. pub fn fromGLFW(key: c_int) ?Key {
  13. return switch (key) {
  14. c.GLFW_KEY_ESCAPE => .Escape,
  15. c.GLFW_KEY_UP => .Up,
  16. c.GLFW_KEY_DOWN => .Down,
  17. c.GLFW_KEY_LEFT => .Left,
  18. c.GLFW_KEY_RIGHT => .Right,
  19. else => null,
  20. };
  21. }
  22. };
Advertisement
Add Comment
Please, Sign In to add comment