diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-01-26 21:13:30 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-01-26 21:13:30 -0500 |
commit | 302f3dbe2c9f0270e80224e6483544b388c14590 (patch) | |
tree | 91a9723914c9e5535edf704d7ed6e082beb69308 | |
parent | 3cda30bd13d469eb88e2ab3944fc1affb698fe34 (diff) |
Add window-close-hook.
* 2d/window.scm: New hook.
-rw-r--r-- | 2d/window.scm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/2d/window.scm b/2d/window.scm index 7697e07..f2e54fa 100644 --- a/2d/window.scm +++ b/2d/window.scm @@ -41,7 +41,8 @@ open-window close-window with-window - window-resize-hook)) + window-resize-hook + window-close-hook)) (define-record-type <window> (%make-window title resolution fullscreen?) @@ -59,7 +60,9 @@ (define window-width (make-root-signal 0)) (define window-height (make-root-signal 0)) (define window-size (signal-map vector2 window-width window-height)) + (define window-resize-hook (make-hook 2)) +(define window-close-hook (make-hook)) (register-event-handler 'video-resize @@ -70,6 +73,11 @@ (signal-set! window-width (SDL:event:resize:w e)) (signal-set! window-height (SDL:event:resize:h e)))) +(register-event-handler + 'quit + (lambda (e) + (run-hook window-close-hook))) + (define* (open-window window) "Open the game window using the settings in WINDOW." (let ((flags (if (window-fullscreen? window) '(opengl fullscreen) 'opengl)) |