aboutsummaryrefslogtreecommitdiff
path: root/sdl2/keyboard.ha
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-13 16:30:46 +0100
committerDrew DeVault <sir@cmpwn.com>2024-04-19 11:10:28 +0200
commitf2e40ecffec519e1094ed829f8735309ae67997f (patch)
tree8168a12577b1a7f38f0a692aa049b5c3debb3e87 /sdl2/keyboard.ha
parentAdd SDL_GetRendererOutputSize. (diff)
downloadhare-chip8-f2e40ecffec519e1094ed829f8735309ae67997f.tar.gz
add a few functions
these are some sdl functions i needed for a project. there is not much structure beyond that.
Diffstat (limited to '')
-rw-r--r--sdl2/keyboard.ha10
1 files changed, 10 insertions, 0 deletions
diff --git a/sdl2/keyboard.ha b/sdl2/keyboard.ha
index d42fa8a..cc137d2 100644
--- a/sdl2/keyboard.ha
+++ b/sdl2/keyboard.ha
@@ -643,3 +643,13 @@ export fn SDL_GetKeyFromName(name: str) (SDL_Keycode | error) = {
};
return sym;
};
+
+@symbol("SDL_GetKeyboardState") fn _SDL_GetKeyboardState(numkeys: *int) *[*]bool;
+
+export fn SDL_GetKeyboardState() []bool = {
+ let numkeys: int = 0;
+ let arr = _SDL_GetKeyboardState(&numkeys);
+ let arr = arr[..numkeys];
+ return arr;
+};
+