diff options
author | David Thompson <dthompson2@worcester.edu> | 2018-12-13 21:32:32 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2018-12-13 21:32:32 -0500 |
commit | 607e537eaa8614ff9338d7aece5044d98c421584 (patch) | |
tree | fd5a28acb8b47b478cd64a99634af4aded53f78b /chickadee.scm | |
parent | 75c5cdef5c72b4f88ae71ba37e7a94b609996279 (diff) |
Re-add key-pressed? and key-released? procedures.
* chickadee.scm (key-pressed?, key-released?): New procedures.
* examples/grid.scm: Remove (sdl2 input keyboard) import.
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chickadee.scm b/chickadee.scm index 3c10880..73aeae9 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -25,6 +25,7 @@ #:use-module (sdl2) #:use-module (sdl2 events) #:use-module (sdl2 input game-controller) + #:use-module ((sdl2 input keyboard) #:prefix sdl2:) #:use-module (sdl2 input joystick) #:use-module (sdl2 input text) #:use-module (sdl2 mixer) @@ -36,10 +37,20 @@ #:use-module (chickadee render gl) #:use-module (chickadee render gpu) #:use-module (chickadee render viewport) - #:export (current-window + #:export (key-pressed? + key-released? + current-window run-game) #:re-export (abort-game)) +(define (key-pressed? key) + "Return #t if KEY is currently being pressed." + (sdl2:key-pressed? key)) + +(define (key-released? key) + "Return #t if KEY is not currently being pressed." + (sdl2:key-released? key)) + (define *controllers* (make-hash-table)) (define (lookup-controller joystick-id) |