summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-02 17:01:48 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-02 17:01:48 -0400
commitf1bdb8ce4fef8272850b6449ba1a83fd84dd2416 (patch)
treedc0bb008d4c1f7250b576d67b752f9b413069a6d /2d
parent60486f7bc18ba59cde6c612640982a3a0c1ba8da (diff)
Remove frame-sleep and add run-repl.
Diffstat (limited to '2d')
-rw-r--r--2d/game-loop.scm15
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)))