summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-11-15 00:37:45 +0100
committerRicardo Wurmus <rekado@elephly.net>2018-11-15 00:39:18 +0100
commit671e4d8783a60534902fafe1baad1715df579718 (patch)
tree1ee046c6425969a43e56d373af47a648c84e9ac6
parent41a7313ec93cbf3124ce3d0da0d1a32bf68f5ddc (diff)
node: Use run-game/sdl.
-rw-r--r--engine/node.scm47
1 files changed, 25 insertions, 22 deletions
diff --git a/engine/node.scm b/engine/node.scm
index d95cfd9..5f2434b 100644
--- a/engine/node.scm
+++ b/engine/node.scm
@@ -1,5 +1,6 @@
;;; Lisp Game Jam 2018
;;; Copyright © 2018 David Thompson <davet@gnu.org>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
@@ -16,7 +17,7 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (engine node)
- #:use-module (chickadee)
+ #:use-module (chickadee sdl)
#:use-module (chickadee math matrix)
#:use-module (chickadee math quaternion)
#:use-module (chickadee math vector)
@@ -228,24 +229,26 @@ one."
(window-height 480)
window-fullscreen?
(update-hz 60))
- (add-hook! load-hook
- (lambda ()
- (set-root-node! (make-root-node))))
- (add-hook! draw-hook (cut draw/children *root-node* <>))
- (add-hook! update-hook (cut update/children *root-node* <>))
- (add-hook! quit-hook
- (lambda ()
- (visit-while (cut on-quit <>) *root-node*)))
- (add-hook! key-press-hook
- (lambda (key sc mods repeat?)
- (visit-while (cut on-key-press <> key mods repeat?)
- *root-node*)))
- (add-hook! text-input-hook
- (lambda (text)
- (visit-while (cut on-text-edit <> text)
- *root-node*)))
- (run-game #:window-title window-title
- #:window-width window-width
- #:window-height window-height
- #:window-fullscreen? window-fullscreen?
- #:update-hz update-hz))
+ (run-game/sdl #:window-title window-title
+ #:window-width window-width
+ #:window-height window-height
+ #:window-fullscreen? window-fullscreen?
+ #:update-hz update-hz
+ #:load
+ (lambda ()
+ (set-root-node! (make-root-node)))
+ #:draw
+ (cut draw/children *root-node* <>)
+ #:update
+ (cut update/children *root-node* <>)
+ #:quit
+ (lambda ()
+ (visit-while (cut on-quit <>) *root-node*))
+ #:key-press
+ (lambda (key sc mods repeat?)
+ (visit-while (cut on-key-press <> key mods repeat?)
+ *root-node*))
+ #:text-input
+ (lambda (text)
+ (visit-while (cut on-text-edit <> text)
+ *root-node*))))