summaryrefslogtreecommitdiff
path: root/2d/sprite.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-07-21 23:17:27 -0400
committerDavid Thompson <dthompson2@worcester.edu>2013-07-21 23:17:27 -0400
commit8589198aa65e65d937863d417c0265b530faf64d (patch)
tree192f708207b55bb8aedadcb7b5ed62a0f54b055f /2d/sprite.scm
parent032d5c9fe5abf734fd40deef727e4495b08048d0 (diff)
Use sprite color when rendering without a batch.
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)