From 4becd612832be831a841f68dadb045a1c5cf060b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 23 Jun 2013 11:09:07 -0400 Subject: Add default sprite arguments to load-sprite. --- 2d/sprite.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/2d/sprite.scm b/2d/sprite.scm index c5310f7..13bd496 100644 --- a/2d/sprite.scm +++ b/2d/sprite.scm @@ -55,18 +55,20 @@ (rotation sprite-rotation set-sprite-rotation!) (color sprite-color set-sprite-color!)) -(define* (make-sprite texture #:optional (x 0) (y 0) (scale-x 1) (scale-y 1) - (rotation 0) (color '(1 1 1))) - (%make-sprite texture x y scale-x scale-y rotation color)) - (define (set-sprite-scale! sprite scale) "Sets sprite scale-x and scale-y to the same value." (set-sprite-scale-x! sprite scale) (set-sprite-scale-y! sprite scale)) -(define (load-sprite filename) - "Loads a sprite from file with default position, scaling, and rotation values." - (make-sprite (load-texture filename))) +(define* (make-sprite texture #:optional (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))) + "Loads a sprite from file." + (make-sprite (load-texture filename) x y scale-x scale-y rotation color)) (define (draw-sprite sprite) "Renders a sprite." -- cgit v1.2.3