summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/sprite.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/chickadee/render/sprite.scm b/chickadee/render/sprite.scm
index c284ff4..78a2ce5 100644
--- a/chickadee/render/sprite.scm
+++ b/chickadee/render/sprite.scm
@@ -341,7 +341,8 @@ void main (void) {
(define %default-scale (vec2 1.0 1.0))
(define draw-sprite
- (let ((matrix (make-null-matrix4)))
+ (let ((matrix (make-null-matrix4))
+ (%rect (make-rect 0.0 0.0 0.0 0.0)))
(lambda* (texture
position
#:key
@@ -349,7 +350,12 @@ void main (void) {
(scale %default-scale)
(rotation 0.0)
(blend-mode 'alpha)
- (rect (texture-rect texture))
+ ;; Default to an area that is the same size of the
+ ;; texture. 99% of the time that's what you want.
+ (rect (let ((r (texture-rect texture)))
+ (set-rect-width! %rect (rect-width r))
+ (set-rect-height! %rect (rect-height r))
+ %rect))
(shader (force default-shader)))
"Draw TEXTURE at POSITION.
@@ -368,7 +374,7 @@ rendered entirely."
#:position position
#:rotation rotation
#:scale scale)
- (draw-sprite* texture (texture-rect texture) matrix
+ (draw-sprite* texture rect matrix
#:blend-mode blend-mode
#:shader shader))))