diff options
Diffstat (limited to 'src/input.zig')
-rw-r--r-- | src/input.zig | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/input.zig b/src/input.zig index 97ad9b3..873265f 100644 --- a/src/input.zig +++ b/src/input.zig @@ -19,7 +19,7 @@ const Int = std.meta.Int; const EnumField = std.builtin.TypeInfo.EnumField; const endian = @import("builtin").target.cpu.arch.endian(); -const glfw = @import("cimport.zig"); +const c = @import("cimport.zig"); const std = @import("std"); const keys = [_][]const u8{ @@ -54,7 +54,7 @@ pub const Key = @Type(.{ for (keys) |name, i| fields[i] = .{ .name = name, - .value = @field(glfw, "GLFW_KEY_" ++ name), + .value = @field(c, "GLFW_KEY_" ++ name), }; break :blk fields[0..]; }, @@ -104,35 +104,33 @@ pub const Mods = packed struct { } }; -usingnamespace glfw; - /// Key action: https://www.glfw.org/docs/latest/input_guide.html#input_key // TODO: move inside Key: https://github.com/ziglang/zig/issues/6709 pub const KeyAction = enum(c_int) { - press = GLFW_PRESS, - release = GLFW_RELEASE, - repeat = GLFW_REPEAT, + press = c.GLFW_PRESS, + release = c.GLFW_RELEASE, + repeat = c.GLFW_REPEAT, }; /// Mouse buttons: https://www.glfw.org/docs/latest/group__buttons.html pub const MouseButton = enum(c_int) { - @"1" = GLFW_MOUSE_BUTTON_1, - @"2" = GLFW_MOUSE_BUTTON_2, - @"3" = GLFW_MOUSE_BUTTON_3, - @"4" = GLFW_MOUSE_BUTTON_4, - @"5" = GLFW_MOUSE_BUTTON_5, - @"6" = GLFW_MOUSE_BUTTON_6, - @"7" = GLFW_MOUSE_BUTTON_7, - @"8" = GLFW_MOUSE_BUTTON_8, + @"1" = c.GLFW_MOUSE_BUTTON_1, + @"2" = c.GLFW_MOUSE_BUTTON_2, + @"3" = c.GLFW_MOUSE_BUTTON_3, + @"4" = c.GLFW_MOUSE_BUTTON_4, + @"5" = c.GLFW_MOUSE_BUTTON_5, + @"6" = c.GLFW_MOUSE_BUTTON_6, + @"7" = c.GLFW_MOUSE_BUTTON_7, + @"8" = c.GLFW_MOUSE_BUTTON_8, - pub const left = @intToEnum(MouseButton, GLFW_MOUSE_BUTTON_LEFT); - pub const right = @intToEnum(MouseButton, GLFW_MOUSE_BUTTON_RIGHT); - pub const middle = @intToEnum(MouseButton, GLFW_MOUSE_BUTTON_MIDDLE); + pub const left = @intToEnum(MouseButton, c.GLFW_MOUSE_BUTTON_LEFT); + pub const right = @intToEnum(MouseButton, c.GLFW_MOUSE_BUTTON_RIGHT); + pub const middle = @intToEnum(MouseButton, c.GLFW_MOUSE_BUTTON_MIDDLE); /// Mouse button input action: /// https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button pub const Action = enum(c_int) { - press = GLFW_PRESS, - release = GLFW_RELEASE, + press = c.GLFW_PRESS, + release = c.GLFW_RELEASE, }; }; |