summaryrefslogtreecommitdiff
path: root/examples/particles.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-12-30 19:32:19 -0500
committerDavid Thompson <dthompson2@worcester.edu>2024-05-03 10:09:45 -0400
commit20a1c5cfe09b6f20dff7a345507a33975ab20ad1 (patch)
tree3bba068bc3a07bb79fccc27a4e086f84db3a5536 /examples/particles.scm
parent9a19f12c464468427a4b4526c354c0934e93ea87 (diff)
WIP graphics engine rewrite.wip-graphics-backend
Diffstat (limited to 'examples/particles.scm')
-rw-r--r--examples/particles.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/particles.scm b/examples/particles.scm
index cab390b..c046fa8 100644
--- a/examples/particles.scm
+++ b/examples/particles.scm
@@ -17,7 +17,7 @@
(define sprite-texture #f)
(define start-time 0.0)
(define avg-frame-time 0)
-(define stats-text "")
+(define stats-text "particles: 0 fps: 0.0")
(define (center-x w)
(- (/ window-width 2.0) (/ w 2.0)))
@@ -27,10 +27,10 @@
(define (load)
(set! *random-state* (random-state-from-platform))
- (set! particle-texture (load-image "images/explosion.png"))
+ (set! particle-texture (texture-view (load-image "images/explosion.png")))
(set! sprite-texture (load-image "images/chickadee.png"))
- (set! particles (make-particles 2000
- #:texture particle-texture
+ (set! particles (make-particles 512
+ #:texture-view particle-texture
#:end-color (make-color 1.0 1.0 1.0 0.8)
#:end-color (make-color 1.0 1.0 1.0 0.0)
#:speed-range (vec2 1.0 5.0)
@@ -72,9 +72,13 @@
(set-rect-y! area y)
(set-vec2! sprite-position (- x 64.0) (- y 64.0))))
+(define (key-press key modifiers repeat?)
+ (when (eq? key 'q) (abort-game)))
+
(run-game #:load load
#:draw draw
#:update update
+ #:key-press key-press
#:mouse-move mouse-move
#:window-width window-width
#:window-height window-height)