diff options
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/chickadee.scm b/chickadee.scm index 73aeae9..9e230a3 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -25,8 +25,9 @@ #: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 keyboard) #:prefix sdl2:) + #:use-module ((sdl2 input mouse) #:prefix sdl2:) #:use-module (sdl2 input text) #:use-module (sdl2 mixer) #:use-module (sdl2 video) @@ -37,7 +38,11 @@ #:use-module (chickadee render gl) #:use-module (chickadee render gpu) #:use-module (chickadee render viewport) - #:export (key-pressed? + #:export (mouse-x + mouse-y + mouse-button-pressed? + mouse-button-released? + key-pressed? key-released? current-window run-game) @@ -51,6 +56,22 @@ "Return #t if KEY is not currently being pressed." (sdl2:key-released? key)) +(define (mouse-x) + "Return the current X coordinate of the mouse cursor." + (sdl2:mouse-x)) + +(define (mouse-y) + "Return the current Y coordinate of the mouse cursor." + (sdl2:mouse-y)) + +(define (mouse-button-pressed? button) + "Return #t if BUTTON is currently being pressed." + (sdl2:mouse-button-pressed? button)) + +(define (mouse-button-released? button) + "Return #t if BUTTON is not currently being pressed." + (sdl2:mouse-button-released? button)) + (define *controllers* (make-hash-table)) (define (lookup-controller joystick-id) |