Mercurial > touhou
changeset 477:e71b1bcf952a
Wait a bit for incoming messages...
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Wed, 28 Dec 2011 19:07:37 +0100 |
parents | 44c5e7d4b615 |
children | 884ca91b0854 |
files | pytouhou/network.py pytouhou/ui/gamerunner.py |
diffstat | 2 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/network.py +++ b/pytouhou/network.py @@ -12,14 +12,13 @@ class Network(object): self.remote_addr = dest self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - self.sock.setblocking(0) self.sock.bind(('', port)) def read_messages(self): messages = [] - rlist, wlist, xlist = select([self.sock], [], [], 0) + rlist, wlist, xlist = select([self.sock], [], [], 1./60.) while rlist: msg, addr = rlist[0].recvfrom(MSG_STRUCT.size) # Check whether the message comes from the right address
--- a/pytouhou/ui/gamerunner.py +++ b/pytouhou/ui/gamerunner.py @@ -70,7 +70,7 @@ class GameRunner(pyglet.window.Window, G glEnableClientState(GL_TEXTURE_COORD_ARRAY) # Use our own loop to ensure 60 (for now, 120) fps - pyglet.clock.set_fps_limit(120) + pyglet.clock.set_fps_limit(60) while not self.has_exit: pyglet.clock.tick() self.dispatch_events()