mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
gg: add is_key_down/1 helper method
This commit is contained in:
parent
2fd3b7e881
commit
17695801ea
8
vlib/gg/keyboard.v
Normal file
8
vlib/gg/keyboard.v
Normal file
@ -0,0 +1,8 @@
|
||||
module gg
|
||||
|
||||
// is_key_down returns whether the given key is currently pressed.
|
||||
// You can use this, if you do not want to implement your own key event handling.
|
||||
@[inline]
|
||||
pub fn (mut ctx Context) is_key_down(k KeyCode) bool {
|
||||
return ctx.pressed_keys[int(k)]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user