summaryrefslogtreecommitdiff
path: root/2d/sprite.scm
diff options
context:
space:
mode:
Diffstat (limited to '2d/sprite.scm')
-rw-r--r--2d/sprite.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/2d/sprite.scm b/2d/sprite.scm
index 12355ba..3b520b7 100644
--- a/2d/sprite.scm
+++ b/2d/sprite.scm
@@ -314,7 +314,6 @@ which frame to show. Returns a new animation-state object."
(rotation 0) (color #xffffffff) (anchor 'center))
"Makes a new sprite object."
(let ((vertices (make-packed-array sprite-vertex 4))
- (color (rgba->gl-color color))
(animation-state (if (animation? drawable)
(make-animation-state drawable)
#f)))
@@ -395,6 +394,7 @@ sprite."
(let* ((vertices (sprite-vertices sprite))
(texture (sprite-texture sprite))
(size (sprite-drawable-size sprite))
+ (color (rgba->gl-color (sprite-color sprite)))
(anchor (sprite-anchor-vector sprite))
(tex-coords (sprite-texture-coords sprite))
(x (- (vx anchor)))
@@ -404,22 +404,26 @@ sprite."
(u (first tex-coords))
(v (second tex-coords))
(u2 (third tex-coords))
- (v2 (fourth tex-coords)))
+ (v2 (fourth tex-coords))
+ (r (vector-ref color 0))
+ (g (vector-ref color 1))
+ (b (vector-ref color 2))
+ (a (vector-ref color 3)))
(pack vertices 0 sprite-vertex
x y
- 1 1 1 1
+ r g b a
u v)
(pack vertices 1 sprite-vertex
x2 y
- 1 1 1 1
+ r g b a
u2 v)
(pack vertices 2 sprite-vertex
x2 y2
- 1 1 1 1
+ r g b a
u2 v2)
(pack vertices 3 sprite-vertex
x y2
- 1 1 1 1
+ r g b a
u v2)))
(define (draw-sprite sprite)