diff options
author | David Thompson <dthompson2@worcester.edu> | 2019-01-06 00:05:47 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2019-01-06 00:05:47 -0500 |
commit | a969c1059b636a8f8807c621c35d1382259367f1 (patch) | |
tree | 7f23d8b5011ef243b30bdd5dadba30ebd13ac4a7 /chickadee.scm | |
parent | 088dddcd454d58efc2545a78d4f7a126b9c7e4c0 (diff) |
Add controller-name procedure.
* chickadee.scm (controller-name): New procedure.
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chickadee.scm b/chickadee.scm index e14f924..0b46237 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -38,9 +38,11 @@ #:use-module (chickadee render gl) #:use-module (chickadee render gpu) #:use-module (chickadee render viewport) + #:use-module (chickadee utils) #:export (current-window controller-button-pressed? controller-axis + controller-name key-pressed? key-released? mouse-x @@ -108,6 +110,13 @@ not being pushed at all." (/ (sdl2:game-controller-axis controller axis) 32768.0)) +(define controller-name + ;; Memoize to avoid repeated allocation of strings via + ;; pointer->string. + (memoize + (lambda (controller) + (sdl2:game-controller-name controller)))) + (define current-window (make-parameter #f)) (define* (run-game #:key |