diff options
author | David Thompson <dthompson2@worcester.edu> | 2017-01-19 09:24:19 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2017-01-19 09:30:18 -0500 |
commit | 3227d8393d857f8df221e5df9383ca203ad418f8 (patch) | |
tree | ca659ea439b286dfd19f20f4d2e1d7433ae22b5d /chickadee.scm | |
parent | 084c80a0fcfc28af7fff5c85dced7e8350d56252 (diff) |
render: Add viewports.
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/chickadee.scm b/chickadee.scm index b9996e1..41a3d90 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -20,9 +20,12 @@ #:use-module (sdl2) #:use-module (sdl2 events) #:use-module (sdl2 input text) + #:use-module (chickadee color) #:use-module (chickadee window) + #:use-module (chickadee render) #:use-module (chickadee render gl) #:use-module (chickadee render gpu) + #:use-module (chickadee render viewport) #:export (load-hook update-hook before-draw-hook @@ -142,7 +145,13 @@ (controller-axis-event-axis event) (/ (controller-axis-event-value event) 32768.0))))) (with-window window - (let ((update-interval (round (/ 1000 update-hz)))) + (let ((update-interval (round (/ 1000 update-hz))) + (default-viewport + (make-viewport 0 0 window-width window-height + ;; Just a fun color from the Dawnbringer + ;; 32-color palette instead of boring old + ;; black. + #:clear-color (rgb #x45283c)))) (call-with-prompt game-loop-prompt-tag (lambda () ;; Catch SIGINT and kill the loop. @@ -170,11 +179,8 @@ (begin ;; Render a frame. (run-hook before-draw-hook) - (gl-clear-color 0.267 0.141 0.204 1.0) - (gl-clear (logior (attrib-mask color-buffer) - (attrib-mask depth-buffer) - (attrib-mask stencil-buffer))) - (run-hook draw-hook (/ lag update-interval)) + (with-viewport default-viewport + (run-hook draw-hook (/ lag update-interval))) (swap-buffers window) (run-hook after-draw-hook) (loop current-time lag))))))) |