diff options
Diffstat (limited to 'examples/particles.scm')
-rw-r--r-- | examples/particles.scm | 12 |
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) |