-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Currently there is no keypress support.
The following loop must be modified:
Lines 34 to 44 in ba98bdb
| while gameState.running: | |
| while sdl2.pollEvent(gameState.event): | |
| case gameState.event.kind: | |
| of QuitEvent: | |
| gameState.running = false | |
| break | |
| of KeyDown: | |
| gameState.running = false | |
| break | |
| else: | |
| break |
KeyDOWN matches pressing
KeyUp matches release
So something like that can be done
while gameState.running:
while sdl2.pollEvent(gameState.event):
case gameState.event.kind:
of QuitEvent:
gameState.running = false
break
of KeyDown:
case event.key.keysym.sym:
of K_KP0: foo(key0)
of K_KP1: foo(key1)
...
else:
break Keycodes are available here: https://github.com/nim-lang/sdl2/blob/master/src/sdl2/private/keycodes.nim
A new "key" array should be added to store the key states (up or down)
Layout
The original key layout is this:
with 2-4-6-8 corresponding to up left right down.
Ideally Chirp-8 should read mapping from a .cfg to so that people can customize their keyboard mapping:
- laptops without a keypad
- non-QWERTY keyboard
- ...
cc @Vindaar
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed
