summaryrefslogtreecommitdiff
path: root/examples/coroutine.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-15 18:59:34 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-15 18:59:34 -0400
commitf5abf968e86cbd55f5a79f8b6826eac42f93ee9f (patch)
tree0108292950e8d5b1ed9c459399f83409acfc59aa /examples/coroutine.scm
parent8748076e491ac5500c7b05248c6ad1c14458b937 (diff)
Update examples.
Diffstat (limited to 'examples/coroutine.scm')
-rw-r--r--examples/coroutine.scm18
1 files changed, 8 insertions, 10 deletions
diff --git a/examples/coroutine.scm b/examples/coroutine.scm
index 2bf7ecb..250cdbb 100644
--- a/examples/coroutine.scm
+++ b/examples/coroutine.scm
@@ -5,11 +5,16 @@
(2d agenda)
(2d coroutine))
-(init-2d)
-
(define window-width 800)
(define window-height 600)
-(define sprite #f)
+
+;; Open the window.
+(open-window window-width window-height)
+
+(define sprite
+ (load-sprite "images/sprite.png"
+ #:position (vector (/ window-width 2)
+ (/ window-height 2))))
(define (key-down key mod unicode)
(cond ((any-equal? key 'escape 'q)
@@ -24,13 +29,6 @@
(add-hook! on-render-hook (lambda () (render)))
(add-hook! on-key-down-hook (lambda (key mod unicode) (key-down key mod unicode)))
-;; Open the window.
-(open-window window-width window-height)
-
-;; Load a sprite and center it on the screen.
-(set! sprite (load-sprite "images/sprite.png" #:position (vector (/ window-width 2)
- (/ window-height 2))))
-
;; Simple script that moves the sprite to a random location every
;; second.
(agenda-schedule