summaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-01 15:08:44 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-01 15:08:44 -0500
commitb3dbfb42b698f3d94ec38606f85c78d3d01a5f38 (patch)
treeae6572572f6b5a5fabf8e3eca8c2e96ce5aeecfb /sdl2
parent9ec24e3f997e40ebde5e8b0057e0324e21fd93a4 (diff)
events: Add predicates for different controller device events.
* sdl2/events.scm (controller-added-event?, controller-removed-event?, controller-remapped-event?): New procedures.
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/events.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/sdl2/events.scm b/sdl2/events.scm
index 56bf233..2c303c7 100644
--- a/sdl2/events.scm
+++ b/sdl2/events.scm
@@ -155,6 +155,9 @@
make-controller-device-event
controller-device-event?
+ controller-added-event?
+ controller-removed-event?
+ controller-remapped-event?
controller-device-event-timestamp
controller-device-event-which
controller-device-event-action
@@ -1205,6 +1208,24 @@
(which controller-device-event-which)
(action controller-device-event-action))
+(define (controller-added-event? event)
+ "Return #t if EVENT is a game controller device event with the
+'added' action."
+ (and (controller-device-event? event)
+ (eq? (controller-device-event-action event) 'added)))
+
+(define (controller-removed-event? event)
+ "Return #t if EVENT is a game controller device event with the
+'removed' action."
+ (and (controller-device-event? event)
+ (eq? (controller-device-event-action event) 'removed)))
+
+(define (controller-remapped-event? event)
+ "Return #t if EVENT is a game controller device event with the
+'remapped' action."
+ (and (controller-device-event? event)
+ (eq? (controller-device-event-action event) 'remapped)))
+
(define (parse-controller-device-event ptr)
(define types
(list uint32 ; type