summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/sprite.scm20
1 files changed, 11 insertions, 9 deletions
diff --git a/chickadee/render/sprite.scm b/chickadee/render/sprite.scm
index 11b8724..7e87494 100644
--- a/chickadee/render/sprite.scm
+++ b/chickadee/render/sprite.scm
@@ -263,15 +263,17 @@ void main (void) {
texture-rect))
(define-syntax-rule (with-batched-sprites body ...)
- (dynamic-wind
- (lambda ()
- (set! *batch?* #t))
- (lambda ()
- (sprite-batch-reset! (force %batch))
- body ...
- (sprite-batch-flush! (force %batch)))
- (lambda ()
- (set! *batch?* #f))))
+ (if *batch?*
+ (begin body ...)
+ (dynamic-wind
+ (lambda ()
+ (set! *batch?* #t))
+ (lambda ()
+ (sprite-batch-reset! (force %batch))
+ body ...
+ (sprite-batch-flush! (force %batch)))
+ (lambda ()
+ (set! *batch?* #f)))))
(define draw-sprite
(let ((rect (make-rect 0.0 0.0 0.0 0.0))