event loop
This commit is contained in:
11
__main__.py
11
__main__.py
@@ -4,11 +4,16 @@ import config
|
|||||||
from factories.NetworkFactory import NetworkFactory
|
from factories.NetworkFactory import NetworkFactory
|
||||||
from factories.GameFactory import GameFactory
|
from factories.GameFactory import GameFactory
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
|
||||||
async def main():
|
|
||||||
|
def main():
|
||||||
args = parseCommandLine()
|
args = parseCommandLine()
|
||||||
game = createGame(args)
|
game = createGame(args)
|
||||||
await game.run()
|
event_loop = asyncio.get_event_loop()
|
||||||
|
event_loop.run_until_complete(game.run())
|
||||||
|
event_loop.close()
|
||||||
|
|
||||||
|
|
||||||
def parseCommandLine():
|
def parseCommandLine():
|
||||||
parser = argparse.ArgumentParser(description='A game for the flippR')
|
parser = argparse.ArgumentParser(description='A game for the flippR')
|
||||||
@@ -17,9 +22,11 @@ def parseCommandLine():
|
|||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def defaultOutputServerAddress():
|
def defaultOutputServerAddress():
|
||||||
return config.SOCKET_PATH + config.OUTPUT_SOCKET_NAME
|
return config.SOCKET_PATH + config.OUTPUT_SOCKET_NAME
|
||||||
|
|
||||||
|
|
||||||
def defaultInputServerAddress():
|
def defaultInputServerAddress():
|
||||||
return config.SOCKET_PATH + config.INPUT_SOCKET_NAME
|
return config.SOCKET_PATH + config.INPUT_SOCKET_NAME
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user