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 | |
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.
-rw-r--r-- | chickadee.scm | 13 | ||||
-rw-r--r-- | examples/grid.scm | 3 |
2 files changed, 13 insertions, 3 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) diff --git a/examples/grid.scm b/examples/grid.scm index 0234746..f20f64d 100644 --- a/examples/grid.scm +++ b/examples/grid.scm @@ -6,8 +6,7 @@ (chickadee render color) (chickadee render font) (chickadee render shapes) - (chickadee render sprite) - (sdl2 input keyboard)) + (chickadee render sprite)) (define grid (make-grid)) (define item-color (make-color 0.7 0.0 0.0 0.5)) |