diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-11 16:09:24 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-11 16:09:24 +0700 |
| commit | b63a0c0c0d227c79ea84d7023f18fbf735be9062 (patch) | |
| tree | b424fafbceb66abd92f138958b44aae8ac71e927 /src/Window.zig | |
| parent | be76fd8b6e8ce2c4be4a53e0f3e9ced369ad5e66 (diff) | |
| download | gfz-b63a0c0c0d227c79ea84d7023f18fbf735be9062.tar.gz | |
Wrap some more input handling
Diffstat (limited to 'src/Window.zig')
| -rw-r--r-- | src/Window.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Window.zig b/src/Window.zig index 087171f..307faf8 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -74,6 +74,12 @@ pub fn shouldClose(self: Window) Error!bool { return flag == GLFW_TRUE; } +/// Set the close flag. +pub fn setShouldClose(self: Window, value: bool) Error!void { + glfwSetWindowShouldClose(self.pimpl, if (value) GLFW_TRUE else GLFW_FALSE); + try checkError(); +} + pub fn swapBuffers(self: Window) Error!void { glfwSwapBuffers(self.pimpl); try checkError(); @@ -118,3 +124,9 @@ pub fn setCursorMode(self: Window, value: CursorMode) Error!void { glfwSetInputMode(self.pimpl, GLFW_CURSOR, @enumToInt(value)); try checkError(); } + +/// Set the key callback. +pub fn setKeyCallback(self: Window, callback: GLFWkeyfun) Error!void { + _ = glfwSetKeyCallback(self.pimpl, callback); + try checkError(); +} |
