diff options
-rw-r--r-- | sdl2/events.scm | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sdl2/events.scm b/sdl2/events.scm index e32c8ef..282fc34 100644 --- a/sdl2/events.scm +++ b/sdl2/events.scm @@ -33,7 +33,11 @@ #:use-module (system foreign) #:use-module ((sdl2 bindings) #:prefix ffi:) #:use-module (sdl2) - #:export (make-window-event + #:export (make-quit-event + quit-event? + quit-event-timestamp + + make-window-event window-event? window-event-timestamp window-event-window-id @@ -102,6 +106,21 @@ ;;; +;;; Quit +;;; + +(define-record-type <quit-event> + (make-quit-event timestamp) + quit-event? + (timestamp quit-event-timestamp)) + +(define (parse-quit-event ptr) + (match (parse-c-struct ptr (list uint32 uint32)) + ((_ timestamp) + (make-quit-event timestamp)))) + + +;;; ;;; Window ;;; @@ -881,6 +900,8 @@ (and (= result 1) (let ((type (sdl-event-type e))) (cond + ((= type ffi:SDL_QUIT) + (parse-quit-event ptr)) ((= type ffi:SDL_WINDOWEVENT) (parse-window-event ptr)) ((or (= type ffi:SDL_KEYDOWN) |