summaryrefslogtreecommitdiff
path: root/sdl2/events.scm
diff options
context:
space:
mode:
Diffstat (limited to 'sdl2/events.scm')
-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