-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (26 loc) · 884 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import logging
from aiohttp import web
from command_manager import Manager
from pyplatformer.game import Game
from pyplatformer.game_client import GameClient
from pyplatformer.game_server import GameServer
logging.basicConfig(level=logging.INFO)
manager = Manager()
@manager.command
def single():
game = Game()
game.initialize_screen()
game.run()
@manager.option("--port", default=8888, type=int)
@manager.option("--host", default="localhost", type=str)
def client(host, port):
client = GameClient(server_addres="http://{}:{}/".format(host, port))
client.run()
@manager.option("--port", default=8888, type=int)
@manager.option("--host", default="localhost", type=str)
def server(host, port):
game_server = GameServer()
app = game_server.get_app()
web.run_app(app, host=host, port=port)
if __name__ == "__main__":
manager.run_command()