Skip to content

Commit f685ee8

Browse files
committed
isKeyPressed, isKeyReleased methods
1 parent 1ec8c63 commit f685ee8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/gui.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,8 +3443,16 @@ extern fn zguiColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: *f32, out_g: *
34433443
pub fn isKeyDown(key: Key) bool {
34443444
return zguiIsKeyDown(key);
34453445
}
3446+
pub fn isKeyPressed(key: Key, repeat: bool) bool {
3447+
return zguiIsKeyPressed(key, repeat);
3448+
}
3449+
pub fn isKeyReleased(key: Key) bool {
3450+
return zguiIsKeyReleased(key);
3451+
}
34463452

34473453
extern fn zguiIsKeyDown(key: Key) bool;
3454+
extern fn zguiIsKeyPressed(key: Key, repeat: bool) bool;
3455+
extern fn zguiIsKeyReleased(key: Key) bool;
34483456
//--------------------------------------------------------------------------------------------------
34493457
//
34503458
// Helpers

src/zgui.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,14 @@ 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+
}
19962004
//--------------------------------------------------------------------------------------------------
19972005
//
19982006
// DrawList

0 commit comments

Comments
 (0)