From f5abf968e86cbd55f5a79f8b6826eac42f93ee9f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Aug 2013 18:59:34 -0400 Subject: Update examples. --- examples/coroutine.scm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'examples/coroutine.scm') 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 -- cgit v1.2.3