diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-01-09 20:21:53 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-01-09 20:21:53 -0500 |
commit | 38c45af24c23d039af07a113725210072293754d (patch) | |
tree | 1b280394513d883951b8d1072aec3f09c9e0d3e2 | |
parent | 13c70844ee8d54778569298bc0a6867b7cda0c37 (diff) |
Add paused-agenda.
* 2d/game.scm (paused-agenda): New variable.
(tick): Tick paused-agenda.
-rw-r--r-- | 2d/game.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/2d/game.scm b/2d/game.scm index c58c419..b2dc0a7 100644 --- a/2d/game.scm +++ b/2d/game.scm @@ -28,11 +28,11 @@ #:use-module (2d agenda) #:use-module (2d coroutine) #:use-module (2d game) - #:use-module (2d mvars) #:use-module (2d signals) #:use-module (2d vector2) #:export (ticks-per-second tick-interval + paused-agenda draw-hook run-game-loop quit-game @@ -55,6 +55,10 @@ (define tick-interval (make-parameter 0)) (define draw-hook (make-hook 2)) (define accumulator (make-parameter 0)) +;; This agenda is only ticked when the game loop is in the paused +;; state. Useful for things like the REPL that should be run even +;; though the game is paused. +(define paused-agenda (make-agenda)) (define (run-game-loop) "Start the game loop." @@ -91,6 +95,8 @@ is the unused accumulator time." "Advance the game by one frame." (if (game-paused?) (begin + (with-agenda paused-agenda + (tick-agenda!)) (SDL:delay (tick-interval)) accumulator) (catch #t |