diff options
author | David Thompson <dthompson2@worcester.edu> | 2013-12-01 22:30:37 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2013-12-01 22:30:37 -0500 |
commit | 8f3718977046ce73e0174b0fa550f91a18106e0d (patch) | |
tree | bd65ba472baff5734d4e689d81ffaa7b4fc97468 /2d/window.scm | |
parent | 936dcbf5179177d38514c3afb5dc185a808db80d (diff) |
Move event handlers and signals into their own modules.
* 2d/game.scm (register-event-handler): New procedure.
(mouse-*, key-*, window-*): Remove signals.
* 2d/window.scm (window-size): New signal.
* 2d/mouse.scm: New module.
* 2d/keyboard.scm: New module.
Diffstat (limited to '2d/window.scm')
-rw-r--r-- | 2d/window.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2d/window.scm b/2d/window.scm index f5f16b8..241f71e 100644 --- a/2d/window.scm +++ b/2d/window.scm @@ -26,6 +26,8 @@ #:use-module (figl gl) #:use-module ((sdl sdl) #:prefix SDL:) #:use-module ((sdl mixer) #:prefix SDL:) + #:use-module (2d game) + #:use-module (2d signals) #:use-module (2d vector2) #:export (<window> make-window @@ -33,6 +35,7 @@ window-title window-resolution window-fullscreen? + window-size open-window close-window with-window)) @@ -50,6 +53,15 @@ (fullscreen? #f)) (%make-window title resolution fullscreen?)) +(define window-size (make-signal #:init (vector2 0 0))) + +(register-event-handler + 'video-resize + (lambda (e) + (signal-set! window-size + (vector2 (SDL:event:resize:w e) + (SDL:event:resize:h e))))) + (define* (open-window window) "Open the game window using the settings in WINDOW." (let ((flags (if (window-fullscreen? window) '(opengl fullscreen) 'opengl)) |