Пример #1
0
 def __init__(self, name='demo'):
     init()
     State.events = EventManager()
     State.game = util.load_cfg(name)
     State.clock = Clock(10, State.game['frame_rate'])
     State.window = display.set_mode(State.game['screen_size'])
     self.create_screens()
Пример #2
0
    def __init__(self, name='demo'):
        """Initialise pygame and load the parameters for the game indicated
        by the `name` param. Start the clock for the screen's frame rate and
        create a window surface for the game's screen size.

        Create each of the screen objects referenced by the game and store
        their state, ready to show.
        """
        init()
        joystick.init()
        for i in range(joystick.get_count()):
            joystick.Joystick(i).init()

        State.game = util.load_cfg(name)
        State.clock = Clock(10, State.game['frame_rate'])
        State.window = display.set_mode(State.game['screen_size'])

        self._last_joystick_action = None
        self.create_screens()