diff options
author | David Thompson <dthompson2@worcester.edu> | 2017-01-11 21:48:00 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2017-01-12 19:00:09 -0500 |
commit | ffa8ea5542404b7f80d6ac669605e0ab6f0c8a9b (patch) | |
tree | 1e1e40404cba0844d5b614ede04f7eb6b9c7b4ba | |
parent | 9c02f7fcf882e8c6a4f6bc6eeffe52cf4103bfa8 (diff) |
render: sprite: Don't reset batch if batching is already active.
* chickadee/render/sprite.scm (with-batched-sprites): Test if *batch?*
is false before resetting state.
-rw-r--r-- | chickadee/render/sprite.scm | 20 |
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)) |