From 6bdd1e305834dcc9be22d9a54d84f025a24d4825 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 10 Jan 2014 07:38:47 -0500 Subject: Change tick-agenda! and clear-agenda! to take agenda as arg. * 2d/agenda.scm (tick-agenda!, clear-agenda!): Add agenda param. * 2d/game.scm (update, tick): Update usage of tick-agenda!. --- 2d/agenda.scm | 12 ++---------- 2d/game.scm | 5 ++--- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to '2d') diff --git a/2d/agenda.scm b/2d/agenda.scm index 4b28c16..46d6c12 100644 --- a/2d/agenda.scm +++ b/2d/agenda.scm @@ -145,7 +145,7 @@ and enqueue CALLBACK." ((deq! q)) ;; Execute scheduled procedure (flush-queue! q))) -(define (%update-agenda agenda) +(define (tick-agenda! agenda) "Move AGENDA forward in time and run scheduled procedures." (set-agenda-time! agenda (1+ (agenda-time agenda))) (let next-segment () @@ -158,7 +158,7 @@ and enqueue CALLBACK." (set-agenda-segments! agenda (rest-segments agenda)) (next-segment)))))) -(define (%clear-agenda agenda) +(define (clear-agenda! agenda) "Remove all scheduled procedures from AGENDA." (set-agenda-segments! agenda '())) @@ -198,14 +198,6 @@ next tick." tick." (schedule-interval thunk 1)) -(define (tick-agenda!) - "Advance time by 1 for the current agenda." - (%update-agenda (current-agenda))) - -(define (clear-agenda!) - "Clear the current agenda." - (%clear-agenda (current-agenda))) - (define* (wait #:optional (delay 1)) "Yield coroutine and schedule the continuation to be run after DELAY ticks. DELAY is 1 by default." diff --git a/2d/game.scm b/2d/game.scm index b3f57ac..eb297a9 100644 --- a/2d/game.scm +++ b/2d/game.scm @@ -81,7 +81,7 @@ many times as `tick-interval` can divide ACCUMULATOR. The return value is the unused accumulator time." (while (>= (accumulator) (tick-interval)) (read-input) - (tick-agenda!) + (tick-agenda! *global-agenda*) (accumulator (- (accumulator) (tick-interval))))) (define (alpha) @@ -95,8 +95,7 @@ is the unused accumulator time." "Advance the game by one frame." (if (game-paused?) (begin - (with-agenda paused-agenda - (tick-agenda!)) + (tick-agenda! paused-agenda) (SDL:delay (tick-interval)) accumulator) (catch #t -- cgit v1.2.3