diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-15 11:50:55 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-15 11:50:55 +0700 |
| commit | bac6c9042375f2a09d6505cc8dda20166c1a1528 (patch) | |
| tree | 885ef5e9d23f319a28c3e6402563f6e2d4e3d7c7 /src/Window.zig | |
| parent | 020d123696219a1e258c06f2c4fdd0b725335cce (diff) | |
| download | gfz-bac6c9042375f2a09d6505cc8dda20166c1a1528.tar.gz | |
Wrap mouse callbacks
Diffstat (limited to 'src/Window.zig')
| -rw-r--r-- | src/Window.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Window.zig b/src/Window.zig index 506225a..5a4424b 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -260,6 +260,13 @@ pub fn setCursorPos(self: Window, xpos: f64, ypos: f64) Error!void { try checkError(); } +/// Set the cursor position callback. +pub fn setCursorPosCallback(self: Window, + callback: GLFWcursorposfun) Error!void { + _ = glfwSetCursorPosCallback(self.pimpl, callback); + try checkError(); +} + const State = enum(c_int) { press = GLFW_PRESS, release = GLFW_RELEASE, @@ -272,6 +279,13 @@ pub fn getMouseButton(self: Window, button: c_int) Error!State { return @intToEnum(State, state); } +/// Set the mouse button callback. +pub fn setMouseButtonCallback(self: Window, + callback: GLFWmousebuttonfun) Error!void { + _ = glfwSetMouseButtonCallback(self.pimpl, callback); + try checkError(); +} + /// Return the last reported state of a keyboard key. pub fn getKey(self: Window, key: c_int) Error!State { const state = glfwGetKey(self.pimpl, key); |
