diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2024-06-12 21:15:52 -0500 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2024-06-12 21:15:52 -0500 |
| commit | 963fae202108acd0498349e872e4811fa6c6aba0 (patch) | |
| tree | 1a7d5b6ee837700819d8f6f5a2484342a0ab6ec1 /vendor/zgui/src/backend_glfw.zig | |
| parent | 6084001df845815efd9c0eb712acf4fd9311ce36 (diff) | |
| download | particle-sim-963fae202108acd0498349e872e4811fa6c6aba0.tar.gz | |
Added imgui for configuration
Diffstat (limited to 'vendor/zgui/src/backend_glfw.zig')
| -rw-r--r-- | vendor/zgui/src/backend_glfw.zig | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/zgui/src/backend_glfw.zig b/vendor/zgui/src/backend_glfw.zig new file mode 100644 index 0000000..83603fe --- /dev/null +++ b/vendor/zgui/src/backend_glfw.zig @@ -0,0 +1,35 @@ +const gui = @import("gui.zig"); + +// This call will install GLFW callbacks to handle GUI interactions. +// Those callbacks will chain-call user's previously installed callbacks, if any. +// This means that custom user's callbacks need to be installed *before* calling zgpu.gui.init(). +pub fn init( + window: *const anyopaque, // zglfw.Window +) void { + if (!ImGui_ImplGlfw_InitForOther(window, true)) { + unreachable; + } +} + +pub fn initOpenGL( + window: *const anyopaque, // zglfw.Window +) void { + if (!ImGui_ImplGlfw_InitForOpenGL(window, true)) { + unreachable; + } +} + +pub fn deinit() void { + ImGui_ImplGlfw_Shutdown(); +} + +pub fn newFrame() void { + ImGui_ImplGlfw_NewFrame(); +} + +// Those functions are defined in `imgui_impl_glfw.cpp` +// (they include few custom changes). +extern fn ImGui_ImplGlfw_InitForOther(window: *const anyopaque, install_callbacks: bool) bool; +extern fn ImGui_ImplGlfw_InitForOpenGL(window: *const anyopaque, install_callbacks: bool) bool; +extern fn ImGui_ImplGlfw_NewFrame() void; +extern fn ImGui_ImplGlfw_Shutdown() void; |
