diff options
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/chickadee.scm b/chickadee.scm index 9e230a3..9b225ba 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -38,13 +38,15 @@ #:use-module (chickadee render gl) #:use-module (chickadee render gpu) #:use-module (chickadee render viewport) - #:export (mouse-x + #:export (current-window + controller-button-pressed? + controller-axis + key-pressed? + key-released? + mouse-x mouse-y mouse-button-pressed? mouse-button-released? - key-pressed? - key-released? - current-window run-game) #:re-export (abort-game)) @@ -95,6 +97,18 @@ (add-controller i)) (loop (+ i 1))))) +(define (controller-button-pressed? controller button) + "Return #t if BUTTON is currently being pressed on CONTROLLER." + (sdl2:game-controller-button-pressed? controller button)) + +(define (controller-axis controller axis) + "Return a floating point value in the range [-1, 1] corresponding to +how much AXIS is being pushed on CONTROLLER. 0 is returned if AXIS is +not being pushed at all." + (- (/ (sdl2:game-controller-axis controller axis) + 32768.0) + 0.5)) + (define current-window (make-parameter #f)) (define* (run-game #:key |