diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-08-15 18:59:34 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-08-15 18:59:34 -0400 |
commit | f5abf968e86cbd55f5a79f8b6826eac42f93ee9f (patch) | |
tree | 0108292950e8d5b1ed9c459399f83409acfc59aa /examples/action.scm | |
parent | 8748076e491ac5500c7b05248c6ad1c14458b937 (diff) |
Update examples.
Diffstat (limited to 'examples/action.scm')
-rw-r--r-- | examples/action.scm | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/examples/action.scm b/examples/action.scm index acc1434..eb2d65e 100644 --- a/examples/action.scm +++ b/examples/action.scm @@ -7,11 +7,17 @@ (2d actions) (2d vector)) -(init-2d) - (define window-width 800) (define window-height 600) -(define sprite #f) + +;; Open the window. +(open-window window-width window-height) + +;; Load a sprite and center it on the screen. +(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) @@ -26,15 +32,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 |