From 21ff408c45685afacd3c0fffb3f81c46e9b00874 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 6 Feb 2014 20:49:28 -0500 Subject: 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. --- 2d/game.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '2d/game.scm') 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) -- cgit v1.2.3