summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-02-15 13:08:47 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-02-15 13:08:47 -0500
commit299ef46b8c6f373038c55771d24950a80c0e58ea (patch)
tree784ee2d41cee1ed8379508e0f98823572ca095db
parentb346663c1d0b8ff6c96ac8e42c4c397e34f59378 (diff)
Add window-projection signal.
* 2d/window.scm (window-projection): New variable.
-rw-r--r--2d/window.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/2d/window.scm b/2d/window.scm
index f2e54fa..176d867 100644
--- a/2d/window.scm
+++ b/2d/window.scm
@@ -28,6 +28,7 @@
#:use-module ((sdl mixer) #:prefix SDL:)
#:use-module (2d event)
#:use-module (2d signals)
+ #:use-module (2d transform)
#:use-module (2d vector2)
#:export (<window>
make-window
@@ -38,6 +39,7 @@
window-width
window-height
window-size
+ window-projection
open-window
close-window
with-window
@@ -60,6 +62,12 @@
(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-projection
+ (signal-map (lambda (size)
+ (if (or (zero? (vx size)) (zero? (vy size)))
+ identity-transform
+ (orthographic-projection 0 (vx size) 0 (vy size) -1 1)))
+ window-size))
(define window-resize-hook (make-hook 2))
(define window-close-hook (make-hook))