Beispiel #1
0
class ClientApp(object):
    """An instance of the game application running on the client's computer."""

    def __init__(self):
        slogging.init()
        self.log = slogging.get(__name__)

    def __del__(self):
        slogging.shutdown()

    def _init_new_game(self):
        """Initializes running a new game."""

        self.window = pyglet.window.Window()

        self.renderer = Renderer(self.window)
        self.game = ClientGame(self.window)

        self.game_loop = FixedStepLoop(self.game.tick, 1.0 / 30, 0.5)
        self.game_loop.schedule()

    def run(self):
        self._init_new_game()
        pyglet.app.run()

    def request_shutdown(self):
        pyglet.app.exit()
Beispiel #2
0
    def _init_new_game(self):
        """Initializes running a new game."""

        self.window = pyglet.window.Window()

        self.renderer = Renderer(self.window)
        self.game = ClientGame(self.window)

        self.game_loop = FixedStepLoop(self.game.tick, 1.0 / 30, 0.5)
        self.game_loop.schedule()