From 107ac54f43dc24f1067e17a57a6599b089d17d04 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 6 Jul 2013 18:58:10 -0400 Subject: Change sprite-batch-draw parameter list to use optional keyword arguments. --- 2d/sprite.scm | 7 ++++--- examples/tilemap.scm | 14 +++++++------- 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)) -- cgit v1.2.3