diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-09-02 17:01:48 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-09-02 17:01:48 -0400 |
commit | f1bdb8ce4fef8272850b6449ba1a83fd84dd2416 (patch) | |
tree | dc0bb008d4c1f7250b576d67b752f9b413069a6d | |
parent | 60486f7bc18ba59cde6c612640982a3a0c1ba8da (diff) |
Remove frame-sleep and add run-repl.
-rw-r--r-- | 2d/game-loop.scm | 15 |
1 files 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))) |