summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-13 21:01:32 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-13 21:01:32 -0400
commitb07a1b84e04bad8dd093342b4ac59de455f19b9c (patch)
tree11b0549f53ec60d0d19113ee2e19ea504fb410ec
parent419e220eb5dd9391b02faad8c25f5f5e28079f5d (diff)
Add mouse wheel event handler.
-rw-r--r--chickadee.scm4
-rw-r--r--doc/api.texi14
2 files changed, 18 insertions, 0 deletions
diff --git a/chickadee.scm b/chickadee.scm
index a8251f3..989056b 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -258,6 +258,7 @@ border is disabled, otherwise it is enabled.")
(mouse-press (const #t))
(mouse-release (const #t))
(mouse-move (const #t))
+ (mouse-wheel (const #t))
(controller-add (const #t))
(controller-remove (const #t))
(controller-press (const #t))
@@ -325,6 +326,9 @@ border is disabled, otherwise it is enabled.")
(mouse-motion-event-x-rel event)
(- (mouse-motion-event-y-rel event))
(mouse-motion-event-buttons event)))
+ ((mouse-wheel-event? event)
+ (mouse-wheel (mouse-wheel-event-x event)
+ (mouse-wheel-event-y event)))
((and (controller-device-event? event)
(eq? (controller-device-event-action event) 'added))
(controller-add (add-controller
diff --git a/doc/api.texi b/doc/api.texi
index 8a06690..96ac394 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -172,6 +172,20 @@ mouse was moved.
@end enumerate
@item
+@var{mouse-wheel}: Called with two arguments when the mouse wheel is
+scrolled:
+
+@enumerate
+
+@item
+@var{x}: The scroll amount along the X axis.
+
+@item
+@var{y}: The scroll amount along the Y axis.
+
+@end enumerate
+
+@item
@var{controller-add}: Called with a single argument, an SDL game
controller object, when a game controller is connected.