summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-23 21:32:15 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-23 21:32:15 -0500
commit5b722b00e934e8176e570101e911385c99da1bdc (patch)
tree704716f594ea25a2ed22f99699db937a235cc0c8
parent7a9b075864a8fe7025bc5de867583ed97c4a22ba (diff)
Set a default projection matrix for convenience.
-rw-r--r--chickadee.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/chickadee.scm b/chickadee.scm
index f918330..fdf253e 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -21,6 +21,7 @@
#:use-module (sdl2 events)
#:use-module (sdl2 input text)
#:use-module (chickadee color)
+ #:use-module (chickadee math matrix)
#:use-module (chickadee window)
#:use-module (chickadee render)
#:use-module (chickadee render gl)
@@ -147,7 +148,9 @@
(with-window window
(let ((update-interval (round (/ 1000 update-hz)))
(default-viewport
- (make-viewport 0 0 window-width window-height)))
+ (make-viewport 0 0 window-width window-height))
+ (default-projection
+ (orthographic-projection 0 window-width window-height 0 0 1)))
(call-with-prompt game-loop-prompt-tag
(lambda ()
;; Catch SIGINT and kill the loop.
@@ -176,7 +179,8 @@
;; Render a frame.
(run-hook before-draw-hook)
(with-viewport default-viewport
- (run-hook draw-hook (/ lag update-interval)))
+ (with-projection default-projection
+ (run-hook draw-hook (/ lag update-interval))))
(swap-buffers window)
(run-hook after-draw-hook)
(loop current-time lag)))))))