diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-11 17:55:34 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2021-09-12 00:24:04 +0700 |
| commit | c4d5e7dccfdfa102f1aeb39074789ce3d51dac97 (patch) | |
| tree | 93113276729ae0de899fe0b966f916cb87ea4692 /src | |
| parent | b63a0c0c0d227c79ea84d7023f18fbf735be9062 (diff) | |
| download | gfz-c4d5e7dccfdfa102f1aeb39074789ce3d51dac97.tar.gz | |
Wrap resize callback
Diffstat (limited to 'src')
| -rw-r--r-- | src/Window.zig | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Window.zig b/src/Window.zig index 307faf8..919ca9a 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -24,7 +24,8 @@ const getError = gfz.getError; const gfz = @import("gfz.zig"); const Window = @This(); -pimpl: *GLFWwindow, +pub const Impl = GLFWwindow; +pimpl: *Impl, const Options = struct { fullscreen: ?Monitor = null, @@ -42,7 +43,7 @@ fn setHint(hint: c_int, value: anytype) Error!void { } /// Create a window and its associated context. -pub fn create(width: c_int, height: c_int, title: []const u8, +pub fn create(width: c_int, height: c_int, title: [:0]const u8, options: Options, hints: anytype) Error!Window { const Hints = @TypeOf(hints); // TODO: Add all supported GLFW window hints: @@ -125,6 +126,12 @@ pub fn setCursorMode(self: Window, value: CursorMode) Error!void { try checkError(); } +/// Set the size callback. +pub fn setSizeCallback(self: Window, callback: GLFWwindowsizefun) Error!void { + _ = glfwSetWindowSizeCallback(self.pimpl, callback); + try checkError(); +} + /// Set the key callback. pub fn setKeyCallback(self: Window, callback: GLFWkeyfun) Error!void { _ = glfwSetKeyCallback(self.pimpl, callback); |
