diff options
Diffstat (limited to 'sdl2/events.scm')
-rw-r--r-- | sdl2/events.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sdl2/events.scm b/sdl2/events.scm index 1d40a38..edb9306 100644 --- a/sdl2/events.scm +++ b/sdl2/events.scm @@ -42,6 +42,8 @@ make-keyboard-event keyboard-event? + keyboard-down-event? + keyboard-up-event? keyboard-event-timestamp keyboard-event-window-id keyboard-event-pressed? @@ -133,6 +135,16 @@ (scancode keyboard-event-scancode) (modifiers keyboard-event-modifiers)) +(define (keyboard-down-event? e) + "Return #t if E is a key press event." + (and (keyboard-event? e) + (keyboard-event-pressed? e))) + +(define (keyboard-up-event? e) + "Return #t if E is a key release event." + (and (keyboard-event? e) + (not (keyboard-event-pressed? e)))) + (define keycode-map (alist->hash-table `((,ffi:SDLK_UNKNOWN . unknown) |