summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/lines.scm5
-rw-r--r--examples/nine-patch.scm6
-rw-r--r--examples/sprite.scm6
-rw-r--r--examples/text.scm12
-rw-r--r--examples/tiled.scm12
5 files changed, 13 insertions, 28 deletions
diff --git a/examples/lines.scm b/examples/lines.scm
index e6b1929..5e800e0 100644
--- a/examples/lines.scm
+++ b/examples/lines.scm
@@ -25,7 +25,4 @@
#:thickness thickness)))
lines))
-(add-hook! draw-hook draw)
-(add-hook! quit-hook abort-game)
-
-(run-game)
+(run-game/sdl #:draw draw)
diff --git a/examples/nine-patch.scm b/examples/nine-patch.scm
index 5255d34..ed03cab 100644
--- a/examples/nine-patch.scm
+++ b/examples/nine-patch.scm
@@ -16,8 +16,4 @@
(draw-nine-patch image (make-rect 192.0 192.0 256.0 96.0) #:margin 6)
(draw-text font "I am error." (vec2 200.0 266.0)))
-(add-hook! load-hook load)
-(add-hook! draw-hook draw)
-(add-hook! quit-hook abort-game)
-
-(run-game)
+(run-game/sdl #:load load #:draw draw)
diff --git a/examples/sprite.scm b/examples/sprite.scm
index 92ab364..12a9ffb 100644
--- a/examples/sprite.scm
+++ b/examples/sprite.scm
@@ -11,8 +11,4 @@
(define (draw alpha)
(draw-sprite sprite (vec2 256.0 176.0)))
-(add-hook! load-hook load)
-(add-hook! draw-hook draw)
-(add-hook! quit-hook abort-game)
-
-(run-game)
+(run-game/sdl #:load load #:draw draw)
diff --git a/examples/text.scm b/examples/text.scm
index 37ac22c..fd299b7 100644
--- a/examples/text.scm
+++ b/examples/text.scm
@@ -15,12 +15,8 @@
(draw-text font "The quick brown fox jumps over the lazy dog"
(vec2 100.0 100.0)))
-(add-hook! load-hook load)
-(add-hook! draw-hook draw)
-(add-hook! quit-hook abort-game)
-(add-hook! key-press-hook
- (lambda (key scan modifiers repeat?)
- (when (eq? key 'q)
- (abort-game))))
+(define (key-press key scan modifiers repeat?)
+ (when (eq? key 'q)
+ (abort-game)))
-(run-game)
+(run-game/sdl #:load load #:draw draw #:key-press key-press)
diff --git a/examples/tiled.scm b/examples/tiled.scm
index 9e42301..3d33052 100644
--- a/examples/tiled.scm
+++ b/examples/tiled.scm
@@ -23,9 +23,9 @@
('q (abort-game))
(_ #t)))
-(add-hook! load-hook load)
-(add-hook! draw-hook draw)
-(add-hook! key-press-hook key-press)
-(add-hook! quit-hook abort-game)
-
-(run-game #:window-width 320 #:window-height 240 #:window-title "tile map demo")
+(run-game/sdl #:window-width 320
+ #:window-height 240
+ #:window-title "tile map demo"
+ #:load load
+ #:draw draw
+ #:key-press key-press)