From 0262d88b83ec5023c1ff2df711219ad8e89b8f3b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 10 Jan 2014 07:52:06 -0500 Subject: Update animation example. * 2d/examples/animation.scm: Updated. --- examples/animation.scm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'examples/animation.scm') diff --git a/examples/animation.scm b/examples/animation.scm index bee35c2..5464a7d 100644 --- a/examples/animation.scm +++ b/examples/animation.scm @@ -1,12 +1,12 @@ (use-modules (2d animation) (2d game) - (2d scene) (2d sprite) - (2d stage) (2d tileset) (2d vector2) (2d window)) +(load "common.scm") + (define (make-demo-animation) "Load a texture, split it into 64x64 tiles, and build an animated sprite out of it." @@ -21,17 +21,10 @@ sprite out of it." (tileset-ref tiles 26)))) (make-animation frames 6 #t))) -(define animation-scene - (make-scene - "Animation" - #:init (lambda () - (make-sprite (make-demo-animation) - #:position (vector2 320 240))) - #:draw draw-sprite)) +(define sprite (make-sprite (make-demo-animation) + #:position (vector2 320 240))) -(define animation-demo - (make-game - #:title "Animation" - #:first-scene animation-scene)) +(add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite))) -(run-game animation-demo) +(with-window (make-window #:title "Animation") + (run-game-loop)) -- cgit v1.2.3