summaryrefslogtreecommitdiff
path: root/examples/animation.scm
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2015-06-06 20:13:42 -0400
committerDavid Thompson <davet@gnu.org>2015-06-06 20:13:42 -0400
commit57046b0ba98a789fa547ccf56df60458a98e1330 (patch)
treedb1e2edfb83f61e2bc777ac4c71899f288afdd52 /examples/animation.scm
parent2159664c2a5c71b1e2a4cee4b9dd087fad6aa9a2 (diff)
Update examples to use new interfaces.
Diffstat (limited to 'examples/animation.scm')
-rw-r--r--examples/animation.scm17
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/animation.scm b/examples/animation.scm
index c64d581..0a72068 100644
--- a/examples/animation.scm
+++ b/examples/animation.scm
@@ -24,7 +24,8 @@
(sly render camera)
(sly render model)
(sly render sprite)
- (sly render tileset))
+ (sly render tileset)
+ (sly render scene))
(load "common.scm")
@@ -45,18 +46,16 @@
(tween (compose floor lerp) (compose ease-linear ease-loop)
0 frame-count (* frame-count frame-rate))))
-(define-signal scene
- (signal-map (lambda (time)
- (model-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-model (signal-ref scene) camera)))
+(define-signal scene
+ (signal-let ((time (signal-timer)))
+ (let* ((frame (vector-ref walk-cycle (frame-tween time)))
+ (model (model-move (position-tween time) frame)))
+ (make-scene camera model))))
(with-window (make-window #:title "Animation")
- (start-game-loop))
+ (start-game-loop scene))
;;; Local Variables:
;;; compile-command: "../pre-inst-env guile animation.scm"