summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-07-06 21:43:15 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-07-06 21:43:15 -0400
commit6203c30af8624eff342a4803d51f4f94d79c4c24 (patch)
tree1fc7fb5b8e562554b16618283138d2b9ee5463aa
parent8be9c9385b9a491ed222ea74645c0f0e38fdb9b6 (diff)
Update particle demo to use new sprite batching functionality.
-rw-r--r--examples/particles.scm9
1 files 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)))