summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee.scm13
-rw-r--r--examples/grid.scm3
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))