diff options
author | David Thompson <dave@izanagi> | 2013-06-16 14:39:29 -0400 |
---|---|---|
committer | David Thompson <dave@izanagi> | 2013-06-16 14:39:29 -0400 |
commit | 1b5d9454c95625c8175f40c09a867f0d421631b3 (patch) | |
tree | 67c06b698d58b3695a33a6678e2a7e7333b9b008 /2d | |
parent | 7210ad156678c89f3dc9a73e0adf7e50c50888a3 (diff) |
Add a make-sprite procedure with keyword arguments.
Diffstat (limited to '2d')
-rw-r--r-- | 2d/sprite.scm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/2d/sprite.scm b/2d/sprite.scm index 4415974..cbce56b 100644 --- a/2d/sprite.scm +++ b/2d/sprite.scm @@ -45,7 +45,7 @@ ;; The <sprite> object represents a texture with a given position, scale, and ;; rotation. (define-record-type <sprite> - (make-sprite texture x y scale-x scale-y rotation color) + (%make-sprite texture x y scale-x scale-y rotation color) sprite? (texture sprite-texture) (x sprite-x set-sprite-x!) @@ -55,6 +55,10 @@ (rotation sprite-rotation set-sprite-rotation!) (color sprite-color set-sprite-color!)) +(define* (make-sprite texture #:optional (x 0) (y 0) (scale-x 0) (scale-y 0) + (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) @@ -62,7 +66,7 @@ (define (load-sprite filename) "Loads a sprite from file with default position, scaling, and rotation values." - (make-sprite (load-texture filename) 0 0 1 1 0 '(1 1 1))) + (make-sprite (load-texture filename))) (define (draw-sprite sprite) "Renders a sprite." |