laneya

multiplayer roguelike game
git clone https://git.ce9e.org/laneya.git

commit
349ec97a851996249927ca70e95f5fa639000cdf
parent
0930d2f14c35f3ead7a5b3a1aa8d61fdfbdb9906
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-10-07 21:03
client mainloop

Diffstat

M laneya/client.py 8 ++++++++

1 files changed, 8 insertions, 0 deletions


diff --git a/laneya/client.py b/laneya/client.py

@@ -3,6 +3,7 @@ import sys
    3     3 from twisted.python import log
    4     4 from twisted.internet.endpoints import TCP4ClientEndpoint
    5     5 from twisted.internet import reactor
   -1     6 from twisted.internet import task
    6     7 
    7     8 import protocol
    8     9 import deferred as q
@@ -24,6 +25,9 @@ class Client(protocol.ClientProtocolFactory):
   24    25 
   25    26         reactor.callLater(10, lambda: self.sendRequest('logout'))
   26    27 
   -1    28     def mainloop(self):  # TODO
   -1    29         pass
   -1    30 
   27    31 
   28    32 def main():
   29    33     log.startLogging(sys.stdout)
@@ -32,6 +36,10 @@ def main():
   32    36     endpoint = TCP4ClientEndpoint(reactor, 'localhost', 5001)
   33    37     d = endpoint.connect(client)
   34    38     q.fromTwisted(d).then(client.connected, log.err)
   -1    39 
   -1    40     mainloop = task.LoopingCall(client.mainloop)
   -1    41     mainloop.start(0.1)
   -1    42 
   35    43     reactor.run()
   36    44 
   37    45