From f685ee84e5024454989d4dd7795872bbb836e8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tarkan=20sar=C4=B1ta=C5=9F?= Date: Sun, 20 Apr 2025 01:13:28 +0300 Subject: [PATCH 1/2] isKeyPressed, isKeyReleased methods --- src/gui.zig | 8 ++++++++ src/zgui.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/gui.zig b/src/gui.zig index f35bcfd..5eaa6cd 100644 --- a/src/gui.zig +++ b/src/gui.zig @@ -3443,8 +3443,16 @@ extern fn zguiColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: *f32, out_g: * pub fn isKeyDown(key: Key) bool { return zguiIsKeyDown(key); } +pub fn isKeyPressed(key: Key, repeat: bool) bool { + return zguiIsKeyPressed(key, repeat); +} +pub fn isKeyReleased(key: Key) bool { + return zguiIsKeyReleased(key); +} extern fn zguiIsKeyDown(key: Key) bool; +extern fn zguiIsKeyPressed(key: Key, repeat: bool) bool; +extern fn zguiIsKeyReleased(key: Key) bool; //-------------------------------------------------------------------------------------------------- // // Helpers diff --git a/src/zgui.cpp b/src/zgui.cpp index fa6d7e0..3946310 100644 --- a/src/zgui.cpp +++ b/src/zgui.cpp @@ -1993,6 +1993,14 @@ extern "C" { return ImGui::IsKeyDown(key); } + ZGUI_API bool zguiIsKeyPressed(ImGuiKey key, bool repeat) + { + return ImGui::IsKeyPressed(key, repeat); + } + ZGUI_API bool zguiIsKeyReleased(ImGuiKey key) + { + return ImGui::IsKeyReleased(key); + } //-------------------------------------------------------------------------------------------------- // // DrawList From 9415fc3d8dd99c88c69039521df5d97415d752f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tarkan=20sar=C4=B1ta=C5=9F?= Date: Sun, 20 Apr 2025 01:28:44 +0300 Subject: [PATCH 2/2] SetNextFrameWantCaptureKeyboard function added --- src/gui.zig | 4 ++++ src/zgui.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/gui.zig b/src/gui.zig index 5eaa6cd..dd5ac0f 100644 --- a/src/gui.zig +++ b/src/gui.zig @@ -3449,10 +3449,14 @@ pub fn isKeyPressed(key: Key, repeat: bool) bool { pub fn isKeyReleased(key: Key) bool { return zguiIsKeyReleased(key); } +pub fn setNextFrameWantCaptureKeyboard(want_capture_keyboard: bool) void { + zguiSetNextFrameWantCaptureKeyboard(want_capture_keyboard); +} extern fn zguiIsKeyDown(key: Key) bool; extern fn zguiIsKeyPressed(key: Key, repeat: bool) bool; extern fn zguiIsKeyReleased(key: Key) bool; +extern fn zguiSetNextFrameWantCaptureKeyboard(want_capture_keyboard: bool) void; //-------------------------------------------------------------------------------------------------- // // Helpers diff --git a/src/zgui.cpp b/src/zgui.cpp index 3946310..c69f9dd 100644 --- a/src/zgui.cpp +++ b/src/zgui.cpp @@ -2001,6 +2001,10 @@ extern "C" { return ImGui::IsKeyReleased(key); } + ZGUI_API void zguiSetNextFrameWantCaptureKeyboard(bool want_capture_keyboard) + { + ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard); + } //-------------------------------------------------------------------------------------------------- // // DrawList