From f1bdb8ce4fef8272850b6449ba1a83fd84dd2416 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 2 Sep 2013 17:01:48 -0400 Subject: Remove frame-sleep and add run-repl. --- 2d/game-loop.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/2d/game-loop.scm b/2d/game-loop.scm index fec82ef..6f80297 100644 --- a/2d/game-loop.scm +++ b/2d/game-loop.scm @@ -205,13 +205,11 @@ is the unused accumulator time." (lambda () (with-error-to-port error thunk))))))) -(define (frame-sleep time) - "Sleep for time milliseconds. Unlock the mutex beforehand if the -REPL server is waiting to evaluate something." - (if (mvar-empty? repl-mvar) - (SDL:delay time) - (and-let* ((vals (try-take-mvar repl-mvar))) - (apply run-repl-thunk vals)))) +(define (run-repl) + "Execute a thunk from the REPL is there is one." + (unless (mvar-empty? repl-mvar) + (and-let* ((vals (try-take-mvar repl-mvar))) + (apply run-repl-thunk vals)))) ;;; ;;; Game Loop @@ -224,9 +222,10 @@ REPL server is waiting to evaluate something." (dt (- time last-time)) (accumulator (+ accumulator dt)) (remainder (update accumulator))) + (run-repl) (render) (accumulate-fps! dt) - (frame-sleep (time-left (SDL:get-ticks) next-time)) + (SDL:delay (time-left (SDL:get-ticks) next-time)) (game-loop time (+ next-time tick-interval) remainder))) -- cgit v1.2.3