summaryrefslogtreecommitdiff
path: root/examples/animation.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-11-03 20:03:07 -0500
committerDavid Thompson <dthompson2@worcester.edu>2013-11-03 20:03:07 -0500
commit777e31518c8ae52e9e15867fb60c958fa7a15610 (patch)
tree873b2cec6608ef62bbc4e9ecae85d31fe4bf6cc4 /examples/animation.scm
parent49f93e5fe7261dd520a0013508fd02086af6ae17 (diff)
Update examples to use new scene/stage system.
Diffstat (limited to 'examples/animation.scm')
-rw-r--r--examples/animation.scm19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/animation.scm b/examples/animation.scm
index 92da549..6e0c5c7 100644
--- a/examples/animation.scm
+++ b/examples/animation.scm
@@ -8,7 +8,7 @@
(2d vector2)
(2d window))
-(define (demo-animation)
+(define (make-demo-animation)
"Load a texture, split it into 64x64 tiles, and build an animated
sprite out of it."
(let* ((tiles (load-tileset "images/princess.png" 64 64))
@@ -22,18 +22,17 @@ sprite out of it."
(tileset-ref tiles 26))))
(make-animation frames 6 #t)))
-(define-stage-variable sprite
- (make-sprite (demo-animation)
- #:position (vector2 320 240)))
-
-(define demo-scene
+(define animation-scene
(make-scene
- #:draw (lambda ()
- (draw-sprite (sprite)))))
+ "Animation"
+ #:init (lambda ()
+ (make-sprite (make-demo-animation)
+ #:position (vector2 320 240)))
+ #:draw draw-sprite))
(define animation-demo
(make-game
- #:title "Animation"
- #:first-scene demo-scene))
+ #:title "Animation"
+ #:first-scene animation-scene))
(run-game animation-demo)