diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-03-10 20:19:22 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-03-10 20:19:22 -0400 |
commit | 718cc7c73318b09d595ddc2072b74062430ae896 (patch) | |
tree | 60a0e505bdb4004f0d66ca4aa7ef8027e275d5b0 /2d | |
parent | f0ae9c3b2a6ef4cef53a2040685053a66c7e8b71 (diff) |
Don't start the REPL server upon importing (2d repl).
* 2d/repl.scm (start-2d-repl): New procedure.
* examples/common.scm: Start the REPL server.
* sandbox: Start the REPL server.
Diffstat (limited to '2d')
-rw-r--r-- | 2d/repl.scm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/2d/repl.scm b/2d/repl.scm index c2dec6c..02237b6 100644 --- a/2d/repl.scm +++ b/2d/repl.scm @@ -23,12 +23,16 @@ (define-module (2d repl) #:use-module (system repl coop-server) + #:use-module (system repl server) #:use-module (2d agenda) - #:use-module (2d game)) + #:use-module (2d game) + #:export (start-2d-repl)) -(define server (spawn-coop-repl-server)) - -(define (poll-server) - (poll-coop-repl-server server)) - -(schedule-interval game-agenda poll-server 2) +(define* (start-2d-repl #:optional (port (make-tcp-server-socket #:port 37146))) + "Start a cooperative REPL server that listens on the given PORT. By +default, this port is 37146. Additionally, a process is scheduled to +poll the REPL server upon every tick of the game loop." + (let ((server (spawn-coop-repl-server port))) + (schedule-each game-agenda + (lambda () + (poll-coop-repl-server server))))) |