diff options
author | David Thompson <dthompson2@worcester.edu> | 2013-12-15 20:49:59 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2013-12-15 20:49:59 -0500 |
commit | e2b31c192d6e10984629c4e72abf3ed8cfbc9552 (patch) | |
tree | 6a6bf65c87f69bec37b7d261b56e1433fdf72d7e | |
parent | d58fb81dee3fa7dc71dfa61d6e0a9618a2e35f92 (diff) |
Update window module to use new signals API.
* 2d/window.scm (window-width, window-height): New signals.
(window-position): Define in terms of signal-map.
-rw-r--r-- | 2d/window.scm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/2d/window.scm b/2d/window.scm index f520c7a..1d82a97 100644 --- a/2d/window.scm +++ b/2d/window.scm @@ -35,6 +35,8 @@ window-title window-resolution window-fullscreen? + window-width + window-height window-size open-window close-window @@ -53,14 +55,15 @@ (fullscreen? #f)) (%make-window title resolution fullscreen?)) -(define window-size (make-signal (vector2 0 0))) +(define window-width (make-root-signal 0)) +(define window-height (make-root-signal 0)) +(define window-size (signal-map vector2 window-width window-height)) (register-event-handler 'video-resize (lambda (e) - (signal-set! window-size - (vector2 (SDL:event:resize:w e) - (SDL:event:resize:h e))))) + (signal-set! window-width (SDL:event:resize:w e)) + (signal-set! window-height (SDL:event:resize:h e)))) (define* (open-window window) "Open the game window using the settings in WINDOW." |