summaryrefslogtreecommitdiff
path: root/2d/sprite.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-17 23:52:32 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-17 23:52:32 -0400
commite5f352a7e47741e06bd96120d1bd1f8c1f83589a (patch)
tree66612e1d702ed5d1da10c550261a59c7d4face65 /2d/sprite.scm
parent6b217d8c62b75491576682f998acf07af45bcb86 (diff)
Use new color module.
Diffstat (limited to '2d/sprite.scm')
-rw-r--r--2d/sprite.scm14
1 files changed, 7 insertions, 7 deletions
diff --git a/2d/sprite.scm b/2d/sprite.scm
index 1d4d4fd..bf2a0f6 100644
--- a/2d/sprite.scm
+++ b/2d/sprite.scm
@@ -29,6 +29,7 @@
#:use-module (figl contrib packed-struct)
#:use-module ((sdl sdl) #:prefix SDL:)
#:use-module (2d animation)
+ #:use-module (2d color)
#:use-module (2d helpers)
#:use-module (2d math)
#:use-module (2d texture)
@@ -61,11 +62,10 @@
(define (pack-sprite-vertices vertices offset x y width height origin-x origin-y
scale-x scale-y rotation s1 t1 s2 t2 color)
(define (pack-sprite x1 y1 x2 y2 x3 y3 x4 y4)
- (let* ((color (rgba->gl-color color))
- (r (vector-ref color 0))
- (g (vector-ref color 1))
- (b (vector-ref color 2))
- (a (vector-ref color 3)))
+ (let ((r (color-r color))
+ (g (color-g color))
+ (b (color-b color))
+ (a (color-a color)))
;; Vertices go counter clockwise, starting from the top-left
;; corner.
(pack vertices offset sprite-vertex
@@ -157,7 +157,7 @@
(animation-state sprite-animation-state set-sprite-animation-state!))
(define* (make-sprite drawable #:optional #:key (position #(0 0)) (scale #(1 1))
- (rotation 0) (color #xffffffff) (anchor 'center))
+ (rotation 0) (color white) (anchor 'center))
"Makes a new sprite object."
(let ((vertices (make-packed-array sprite-vertex 4))
(animation-state (if (animation? drawable)
@@ -180,7 +180,7 @@ operation that requires a refresh of the vertex array should use this macro."
(dirty-sprite-setter set-sprite-anchor! %set-sprite-anchor!)
(define* (load-sprite filename #:optional #:key (position #(0 0)) (scale #(1 1))
- (rotation 0) (color #xffffffff) (anchor 'center))
+ (rotation 0) (color white) (anchor 'center))
"Loads a sprite from file."
(make-sprite (load-texture filename) #:position position #:scale scale
#:rotation rotation #:color color #:anchor anchor))