summaryrefslogtreecommitdiff
path: root/examples/action.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/action.scm')
-rw-r--r--examples/action.scm21
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