From 6203c30af8624eff342a4803d51f4f94d79c4c24 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 6 Jul 2013 21:43:15 -0400 Subject: Update particle demo to use new sprite batching functionality. --- examples/particles.scm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/particles.scm b/examples/particles.scm index 9883dfb..65bf0ea 100644 --- a/examples/particles.scm +++ b/examples/particles.scm @@ -43,7 +43,7 @@ (define particle-image (load-texture "images/bullet.png")) (define particle-width (texture-width particle-image)) (define particle-height (texture-height particle-image)) -(define particle-count 2000) +(define particle-count 500) (define particles (list-tabulate particle-count (lambda (n) @@ -58,10 +58,9 @@ (with-sprite-batch batch (for-each (lambda (p) - (let* ((pos (particle-position p)) - (x (vx pos)) - (y (vy pos))) - (sprite-batch-draw particle-image x y particle-width particle-height))) + (let* ((sprite (particle-sprite p))) + (set-sprite-position! sprite (particle-position p)) + (draw-sprite sprite))) particles))) (set-render-callback (lambda () (render))) -- cgit v1.2.3