diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-02-06 20:49:28 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-02-06 20:49:28 -0500 |
commit | 21ff408c45685afacd3c0fffb3f81c46e9b00874 (patch) | |
tree | 11d3575ae00255a1319273ece6d94040d31795dc /2d/game.scm | |
parent | c83760250f25373cd5f66ca096b5a762da82d072 (diff) |
Remove dynamic scoping of agendas.
* 2d/agenda.scm: (*global-agenda*, current-agenda, with-agenda): Delete.
(agenda?, agenda-time): Export.
(schedule-every, schedule-each): Rename schedule-every to
schedule-each.
(schedule-next): Delete.
* 2d/game.scm: (game-agenda): New variable.
(update): Tick game-agenda.
* 2d/repl.scm: Use new agenda API.
* 2d/sprite.scm: Use new agenda API.
* 2d/time.scm: (time-every, time-each, time-delay): Change signature and
use new agenda API.
* examples/coroutine.scm: Use new agenda API.
* examples/particles.scm: Use new agenda API.
Diffstat (limited to '2d/game.scm')
-rw-r--r-- | 2d/game.scm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/2d/game.scm b/2d/game.scm index 1594b4a..31780d0 100644 --- a/2d/game.scm +++ b/2d/game.scm @@ -32,6 +32,7 @@ #:use-module (2d window) #:export (ticks-per-second tick-interval + game-agenda paused-agenda draw-hook run-game-loop @@ -54,6 +55,7 @@ (define tick-interval (make-parameter 0)) (define draw-hook (make-hook 2)) (define accumulator (make-parameter 0)) +(define game-agenda (make-agenda)) ;; 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. @@ -86,7 +88,7 @@ many times as `tick-interval` can divide ACCUMULATOR. The return value is the unused accumulator time." (while (>= (accumulator) (tick-interval)) (process-events) - (tick-agenda! *global-agenda*) + (tick-agenda! game-agenda) (accumulator (- (accumulator) (tick-interval))))) (define (alpha) |