thiiiiings
This commit is contained in:
23
Game.py
Normal file
23
Game.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import asyncio
|
||||
import signal
|
||||
|
||||
|
||||
class Game:
|
||||
def __init__(self, input_handler, player_state, game_state):
|
||||
self.input_handler = input_handler
|
||||
self.player_state = player_state
|
||||
self.game_state = game_state
|
||||
signal.signal(signal.SIGINT, self.interrupt)
|
||||
self.is_running = asyncio.Condition()
|
||||
pass
|
||||
|
||||
def interrupt(self):
|
||||
print('Received SIGINT. Stopping Game :-)')
|
||||
self.is_running.release()
|
||||
|
||||
def run(self):
|
||||
self.is_running.acquire()
|
||||
asyncio.run(self.input_handler.handleInputs())
|
||||
|
||||
await self.is_running.wait()
|
||||
pass
|
||||
Reference in New Issue
Block a user