summaryrefslogtreecommitdiff
path: root/examples
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 /examples
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 'examples')
-rw-r--r--examples/mines/mines.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/mines/mines.scm b/examples/mines/mines.scm
index 0b93473..954f17f 100644
--- a/examples/mines/mines.scm
+++ b/examples/mines/mines.scm
@@ -163,8 +163,9 @@
(define (board-update board position tile)
(match position
- (($ <vector2> x y)
- (list-replace board y (list-replace (list-ref board y) x tile)))))
+ ((? vector2? v)
+ (list-replace board (vy v)
+ (list-replace (list-ref board y) (vx v) tile)))))
(define (neighbors board pos)
(let* ((size (length board))