diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-10-29 16:55:29 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-10-29 17:00:02 +0700 |
| commit | d04c5c426841964ea8c525e3610b87f191847cf3 (patch) | |
| tree | 422b98ccc7c638624033297a2ac19d45881c9915 /src/Window.zig | |
| parent | 54468a19adb06eff78a71d425e443171df24b5bb (diff) | |
| download | gfz-d04c5c426841964ea8c525e3610b87f191847cf3.tar.gz | |
Wrap modifier keys
Diffstat (limited to 'src/Window.zig')
| -rw-r--r-- | src/Window.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Window.zig b/src/Window.zig index 74433e8..82ae8c3 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -18,18 +18,20 @@ usingnamespace @import("cimport.zig"); const Error = gfz.Error; -const Key = @import("input.zig").Key; +const Key = input.Key; +const Mods = input.Mods; const Monitor = @import("Monitor.zig"); const checkError = gfz.checkError; const getError = gfz.getError; const gfz = @import("gfz.zig"); +const input = @import("input.zig"); const Self = @This(); const CursorPosFun = fn (window: Self, xpos: f64, ypos: f64) void; const KeyFun = fn (window: Self, key: Key, scancode: c_int, - action: c_int, mods: c_int) void; + action: c_int, mods: Mods) void; const MouseButtonFun = fn (window: Self, button: c_int, - action: c_int, mods: c_int) void; + action: c_int, mods: Mods) void; const SizeFun = fn (window: Self, width: c_int, height: c_int) void; const Impl = GLFWwindow; pimpl: *Impl, @@ -47,14 +49,14 @@ fn fnCast(comptime DestType: type, comptime fun: anytype) DestType { pub fn callback(window: ?*Impl, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void { fun(@fieldParentPtr(Self, "pimpl", &window.?).*, - @intToEnum(Key, key), scancode, action, mods); + @intToEnum(Key, key), scancode, action, Mods.fromInt(mods)); } }, GLFWmousebuttonfun => struct { pub fn callback(window: ?*Impl, button: c_int, action: c_int, mods: c_int) callconv(.C) void { fun(@fieldParentPtr(Self, "pimpl", &window.?).*, - button, action, mods); + button, action, Mods.fromInt(mods)); } }, GLFWwindowsizefun => struct { |
