summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-02 17:23:38 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-02 17:23:38 -0400
commited97fad38db1b2ee109d2c3b292271b37b01a117 (patch)
tree82f40c3a09cf47bb94a38a64690666b7053370f2 /2d
parent582b6be470dd10a80fd8a4a31bce3d92e4b509f2 (diff)
Add some documentation.
Diffstat (limited to '2d')
-rw-r--r--2d/game-loop.scm4
-rw-r--r--2d/repl/repl.scm6
2 files changed, 8 insertions, 2 deletions
diff --git a/2d/game-loop.scm b/2d/game-loop.scm
index af4966f..ab81b5a 100644
--- a/2d/game-loop.scm
+++ b/2d/game-loop.scm
@@ -170,9 +170,13 @@ is the unused accumulator time."
accumulator))
(define (time-left current-time next-time)
+ "Calculate the delta between NEXT-TIME and CURRENT-TIME. If
+NEXT-TIME is less than CURRENT-TIME, 0 is returned."
(max (floor (- next-time current-time)) 0))
(define (run-repl-thunk thunk input output error stack)
+ "Run THUNK with the given REPL STACK. I/O is redirected to the given
+INPUT, OUTPUT, and ERROR ports."
(put-mvar
repl-output-mvar
(with-input-from-port input
diff --git a/2d/repl/repl.scm b/2d/repl/repl.scm
index e6077cd..253789d 100644
--- a/2d/repl/repl.scm
+++ b/2d/repl/repl.scm
@@ -193,9 +193,11 @@
(abort-on-error "parsing expression"
(repl-parse repl exp))))))
(run-hook before-eval-hook exp)
- ;; Insert thunk into repl-mvar. The
+ ;; Insert thunk into repl-mvar. The
;; game loop will schedule it and run
- ;; it on the next tick.
+ ;; it on the next tick. We also pass
+ ;; along the input/output/error ports
+ ;; and the REPL stack.
(put-mvar
repl-input-mvar
(list