From e8be6c28ff61e1febf3a7c2d21ffacd772c487c9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 23 Jun 2013 11:14:02 -0400 Subject: Use keyword arguments in make-sprite and load-sprite. --- 2d/sprite.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to '2d') diff --git a/2d/sprite.scm b/2d/sprite.scm index 13bd496..aa86448 100644 --- a/2d/sprite.scm +++ b/2d/sprite.scm @@ -60,15 +60,17 @@ (set-sprite-scale-x! sprite scale) (set-sprite-scale-y! sprite scale)) -(define* (make-sprite texture #:optional (x 0) (y 0) (scale-x 1) (scale-y 1) - (rotation 0) (color '(1 1 1))) +(define* (make-sprite texture #:optional #:key (x 0) (y 0) + (scale-x 1) (scale-y 1) (rotation 0) (color '(1 1 1))) "Makes a new sprite object." (%make-sprite texture x y scale-x scale-y rotation color)) -(define* (load-sprite filename #:optional (x 0) (y 0) (scale-x 1) (scale-y 1) - (rotation 0) (color '(1 1 1))) +(define* (load-sprite filename #:optional #:key (x 0) (y 0) + (scale-x 1) (scale-y 1) (rotation 0) (color '(1 1 1))) "Loads a sprite from file." - (make-sprite (load-texture filename) x y scale-x scale-y rotation color)) + (make-sprite (load-texture filename) #:x x #:y y + #:scale-x scale-x #:scale-y scale-y + #:rotation rotation #:color color)) (define (draw-sprite sprite) "Renders a sprite." -- cgit v1.2.3