summaryrefslogtreecommitdiff
path: root/2d/window.scm
diff options
context:
space:
mode:
Diffstat (limited to '2d/window.scm')
-rw-r--r--2d/window.scm12
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))