summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-07-06 18:58:10 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-07-06 18:58:10 -0400
commit107ac54f43dc24f1067e17a57a6599b089d17d04 (patch)
tree72d34b999faf017ef376fe4c6009df5ed4e3b0da
parentfcb5ed27346ceef1e94acbdb53e1b78e0b42f2de (diff)
Change sprite-batch-draw parameter list to use optional keyword arguments.
-rw-r--r--2d/sprite.scm7
-rw-r--r--examples/tilemap.scm14
2 files changed, 11 insertions, 10 deletions
diff --git a/2d/sprite.scm b/2d/sprite.scm
index f47a38e..20c6845 100644
--- a/2d/sprite.scm
+++ b/2d/sprite.scm
@@ -339,9 +339,10 @@ size."
;; TODO add transformation logic for scaling and rotating.
;; TODO add support for colors
;; TODO add support for different blending modes.
-(define* (sprite-batch-draw batch texture x y center-x center-y
- width height scale-x scale-y rotation
- #:optional (u 0) (v 0) (u2 1) (v2 1))
+(define* (sprite-batch-draw batch texture x y width height
+ #:optional #:key (center-x 0) (center-y 0)
+ (scale-x 1) (scale-y 1) (rotation 0)
+ (u 0) (v 0) (u2 1) (v2 1))
;; Render the batch when it's full or the texture changes.
(cond ((= (sprite-batch-size batch) (sprite-batch-max-size batch))
(sprite-batch-render batch))
diff --git a/examples/tilemap.scm b/examples/tilemap.scm
index 259bfed..070793e 100644
--- a/examples/tilemap.scm
+++ b/examples/tilemap.scm
@@ -69,13 +69,13 @@
(define map #f)
(define (tiles->texture-regions width height tileset tiles)
- (list->array
- 2
- (list-ec
- (: y height)
- (list-ec
- (: x width)
- (vector-ref tileset (array-ref tiles y x))))))
+ (define (texture-region-at x y)
+ (vector-ref tileset (array-ref tiles y x)))
+
+ (let ((regions (list-ec (: y height)
+ (list-ec (: x width)
+ (texture-region-at x y)))))
+ (list->array 2 regions)))
(define (key-down key mod unicode)
(cond ((any-equal? key (keycode escape) (keycode q))