Skip to content

Commit 02699eb

Browse files
hazeycodeckrowland
authored andcommitted
Merge pull request zig-gamedev#40 from Nefistofeles/main
2 parents 9d86479 + e3b5b24 commit 02699eb

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/gui.zig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,8 +3442,20 @@ extern fn zguiColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: *f32, out_g: *
34423442
pub fn isKeyDown(key: Key) bool {
34433443
return zguiIsKeyDown(key);
34443444
}
3445+
pub fn isKeyPressed(key: Key, repeat: bool) bool {
3446+
return zguiIsKeyPressed(key, repeat);
3447+
}
3448+
pub fn isKeyReleased(key: Key) bool {
3449+
return zguiIsKeyReleased(key);
3450+
}
3451+
pub fn setNextFrameWantCaptureKeyboard(want_capture_keyboard: bool) void {
3452+
zguiSetNextFrameWantCaptureKeyboard(want_capture_keyboard);
3453+
}
34453454

34463455
extern fn zguiIsKeyDown(key: Key) bool;
3456+
extern fn zguiIsKeyPressed(key: Key, repeat: bool) bool;
3457+
extern fn zguiIsKeyReleased(key: Key) bool;
3458+
extern fn zguiSetNextFrameWantCaptureKeyboard(want_capture_keyboard: bool) void;
34473459
//--------------------------------------------------------------------------------------------------
34483460
//
34493461
// Helpers

src/zgui.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,18 @@ extern "C"
19931993
{
19941994
return ImGui::IsKeyDown(key);
19951995
}
1996+
ZGUI_API bool zguiIsKeyPressed(ImGuiKey key, bool repeat)
1997+
{
1998+
return ImGui::IsKeyPressed(key, repeat);
1999+
}
2000+
ZGUI_API bool zguiIsKeyReleased(ImGuiKey key)
2001+
{
2002+
return ImGui::IsKeyReleased(key);
2003+
}
2004+
ZGUI_API void zguiSetNextFrameWantCaptureKeyboard(bool want_capture_keyboard)
2005+
{
2006+
ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard);
2007+
}
19962008
//--------------------------------------------------------------------------------------------------
19972009
//
19982010
// DrawList

0 commit comments

Comments
 (0)