summaryrefslogtreecommitdiff
path: root/examples/animation.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-03-09 08:52:14 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-03-09 08:58:42 -0400
commitd84bb24d2359be9c4be7b3e4f05caf3daf68f243 (patch)
treed57b082948ef75bdd0f9cc5d1c15a8d70d784d26 /examples/animation.scm
parent8ac70ff3cef2963c460ce5382e37946eb0a4914e (diff)
render: Merge <group> into <model>.
* sly/render/model.scm (<model>): Add 'transform' and 'children' fields. (model-transform, model-children): New accessors. (make-model): Add 'transform' and 'children' keyword arguments. (set-transform-identity!): New procedure. (draw-model): Recursively draw model and all children. (model-paint, model-blend): Renamed. (paint, blend, group, group*, move, place): New procedures. * sly/render/group.scm: Delete. * Makefile.am (SOURCES): Remove it. * examples/2048/2048.scm: Update example. * examples/animation.scm: Likewise. * examples/font.scm: Likewise. * examples/joystick.scm: Likewise. * examples/mines/mines.scm: Likewise. * examples/simple.scm: Likewise. * examples/tilemap.scm: Likewise. * README.org (Example): Update sample code.
Diffstat (limited to 'examples/animation.scm')
-rw-r--r--examples/animation.scm13
1 files changed, 5 insertions, 8 deletions
diff --git a/examples/animation.scm b/examples/animation.scm
index cc84c27..ef736d2 100644
--- a/examples/animation.scm
+++ b/examples/animation.scm
@@ -22,7 +22,7 @@
(sly math tween)
(sly math vector)
(sly render camera)
- (sly render group)
+ (sly render model)
(sly render sprite)
(sly render tileset))
@@ -45,18 +45,15 @@
(tween (compose floor lerp) (compose ease-linear ease-loop)
0 frame-count (* frame-count frame-rate))))
-(define-signal timer
- (signal-fold + 0 (signal-every 1)))
-
(define-signal scene
(signal-map (lambda (time)
- (group-move (position-tween time)
- (group (vector-ref walk-cycle (frame-tween time)))))
- timer))
+ (move (position-tween time)
+ (vector-ref walk-cycle (frame-tween time))))
+ (signal-timer)))
(define camera (orthographic-camera 640 480))
-(add-hook! draw-hook (lambda _ (draw-group (signal-ref scene) camera)))
+(add-hook! draw-hook (lambda _ (draw-model (signal-ref scene) camera)))
(with-window (make-window #:title "Animation")
(start-game-loop))