From 671e4d8783a60534902fafe1baad1715df579718 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 15 Nov 2018 00:37:45 +0100 Subject: node: Use run-game/sdl. --- engine/node.scm | 47 +++++++++++++++++++++++++---------------------- 1 file 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 +;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; 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 @@ ;;; . (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*)))) -- cgit v1.2.3