summaryrefslogtreecommitdiff
path: root/sly/game.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-02-27 20:45:09 -0500
committerDavid Thompson <dthompson2@worcester.edu>2016-02-27 20:45:09 -0500
commit873d00e01e7d714fd3cbbb86d3da88380c179145 (patch)
tree3f6d34fa1cdf08ec17475126451f93fd86847ecf /sly/game.scm
parenta319acd01ac950d479d43d77c07d44a9af3012cd (diff)
math: Rewrite vector math library to use packed f64 bytevectors.
The big consequence of this change to the rest of the codebase is that we can no longer use record destructuring when pattern matching, so I had to rewrite every place where pattern matching was used. It was probably a bad idea to expose the record type descriptors publicly in the first place. * sly/math/vector.scm: Reimplement everything in terms of an f64 packed bytevector record type. Do not expose record type descriptors. * sly/game.scm (run-game-loop): Convert viewport width/height to exact numbers. * sly/window.scm (open-window): Likewise. * sly/input/mouse.scm (mouse-position): Rewrite pattern matching. * sly/math/quaternion (make-quaternion, vector->quaternion): Likewise. * sly/math/rect.scm (rect-clamp): Likewise. * sly/math/transform.scm (translate!, translate, scale): Likewise. * sly/render/mesh.scm (vertices-bytevector): Likewise. * examples/mines/mines.scm: Likewise.
Diffstat (limited to 'sly/game.scm')
-rw-r--r--sly/game.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/sly/game.scm b/sly/game.scm
index 66f0893..f4fb948 100644
--- a/sly/game.scm
+++ b/sly/game.scm
@@ -106,7 +106,9 @@ instead of becoming completely unresponsive and possibly crashing."
(define (draw dt alpha)
"Render a frame."
(let ((size (signal-ref window-size)))
- (gl-viewport 0 0 (vx size) (vy size)))
+ (gl-viewport 0 0
+ (inexact->exact (vx size))
+ (inexact->exact (vy size))))
(gl-clear (clear-buffer-mask color-buffer depth-buffer))
(run-hook draw-hook dt alpha)
(with-graphics gfx