movement and sprite flipping

This commit is contained in:
2026-08-01 12:01:17 -07:00
parent 269578548a
commit 5040446ec1
3 changed files with 53 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package engine
import sdl "vendor:sdl3"
Key :: enum {
A,
D,
Left,
Right,
}
key_down :: proc(key: Key) -> bool {
keys := sdl.GetKeyboardState(nil)
if keys == nil do return false
scan_code: sdl.Scancode
switch key {
case .A:
scan_code = .A
case .D:
scan_code = .D
case .Left:
scan_code = .LEFT
case .Right:
scan_code = .RIGHT
}
return keys[scan_code]
}