Skip to content

Commit 1769580

Browse files
committed
gg: add is_key_down/1 helper method
1 parent 2fd3b7e commit 1769580

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

vlib/gg/keyboard.v

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module gg
2+
3+
// is_key_down returns whether the given key is currently pressed.
4+
// You can use this, if you do not want to implement your own key event handling.
5+
@[inline]
6+
pub fn (mut ctx Context) is_key_down(k KeyCode) bool {
7+
return ctx.pressed_keys[int(k)]
8+
}

0 commit comments

Comments
 (0)