This commit is contained in:
Jonas Zeunert
2020-02-14 00:48:38 +01:00
parent 49ecf0f244
commit 22cb3fa229
3 changed files with 3 additions and 6 deletions

View File

@@ -15,8 +15,7 @@ class Game:
print('Received SIGINT. Stopping Game :-)') print('Received SIGINT. Stopping Game :-)')
self.is_running.release() self.is_running.release()
@asyncio.coroutine async def run(self):
def run(self):
self.is_running.acquire() self.is_running.acquire()
asyncio.run(self.input_handler.handleInputs()) asyncio.run(self.input_handler.handleInputs())

View File

@@ -7,8 +7,7 @@ class InputHandler:
self.isRunning = True self.isRunning = True
self.targets = targets self.targets = targets
@asyncio.coroutine async def handleInputs(self):
def handleInputs(self):
self.isRunning = True self.isRunning = True
while self.isRunning: while self.isRunning:
event = await Networking().getInputEvent() event = await Networking().getInputEvent()

View File

@@ -48,8 +48,7 @@ class Networking(metaclass=Singleton):
def writeDisplayScore(self, display, score): def writeDisplayScore(self, display, score):
self.get("/displays/" + display + "/write_score/" + str(score)) self.get("/displays/" + display + "/write_score/" + str(score))
@asyncio.coroutine async def getInputEvent(self):
def getInputEvent(self):
header = list() header = list()
while b'\x02' not in header: while b'\x02' not in header:
byte = self.input_socket.recv(1) byte = self.input_socket.recv(1)