summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/simple.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/simple.scm b/examples/simple.scm
index f9ee142..a988d25 100644
--- a/examples/simple.scm
+++ b/examples/simple.scm
@@ -2,20 +2,22 @@
(figl gl)
(2d sprite)
(2d game-loop)
- (2d window)
- (2d vector))
+ (2d window))
(define window-width 800)
(define window-height 600)
(define sprite #f)
(define (key-down key)
+ (display key) (newline)
(case key
;; Quit program when ESCAPE or Q is pressed.
+ ;; For now we have to use the SDL keycodes, but not for long!
((SDLK_ESCAPE SDLK_q)
(close-window)
(quit))))
+;; Draw our sprite
(define (render)
(draw-sprite sprite))
@@ -26,7 +28,7 @@
;; Open the window.
(open-window window-width window-height)
-;; Load a sprite.
+;; Load a sprite and center it on the screen.
;; Must be done AFTER opening the window.
(set! sprite (load-sprite "sprite.png" #:position (vector (/ window-width 2)
(/ window-height 2))))