summary refs log tree commit diff
path: root/src/Window.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.zig')
-rw-r--r--src/Window.zig14
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);