diff options
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/chickadee.scm b/chickadee.scm index 09212fe..4176b5d 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -16,7 +16,8 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (chickadee) - #:export (run-game + #:export (default-error-handler + run-game abort-game)) @@ -43,11 +44,14 @@ (set! stack (make-stack #t 3)))))) (define-syntax-rule (with-error-handling handler body ...) - (call-with-error-handling handler (lambda () body ...))) + (call-with-error-handling handler (lambda () body ...))) + +(define (default-error-handler stack key args) + (apply throw key args)) ;;; -;;; Game loop core +;;; Game loop kernel ;;; (define game-loop-prompt-tag (make-prompt-tag 'game-loop)) @@ -55,7 +59,9 @@ (define (abort-game) (abort-to-prompt game-loop-prompt-tag #f)) -(define* (run-game #:key update render time error (update-hz 60)) +(define* (run-game #:key update render time + (error default-error-handler) + (update-hz 60)) (let ((timestep (round (/ 1000 update-hz)))) (call-with-prompt game-loop-prompt-tag (lambda () |