def update(self):
        for i in range(len(self.inputState)):
            self.tempInputState[i] = self.inputState[i]

        if not self.block:
            # In multi, the test keys will be those of player 1
            # regardless of the real number of player controller
            if self.multi:
                key = 0
            else:
                key = self.player

            # Different num for each state of key
            # 0 is key releasing
            # 1 is key pressed (1 frame)
            # 2 is key pressing (1 frame after)
            # 3 is key release (1 frame)
            for i in range(0, len(self.states)):
                if im.input(self.VARIABLES[i][key]):
                    # No error
                    if im.inputPressed(self.VARIABLES[i][key]):
                        self.inputState[i] = 2
                    else:
                        self.inputState[i] = 3
                else:
                    if im.inputReleased(self.VARIABLES[i][key]):
                        self.inputState[i] = 1
                    else:
                        self.inputState[i] = 0

        # Call the function with the state of the key
        for i in range(0, len(self.states)):
            if self.states[i][0]:
                self.states[i][1](self.inputState[i])
예제 #2
0
    def update():
        if GameManager.wantChangeScreen:
            GameManager.createCurrentScreen()

        GameManager.currentScreen.update()

        # Dispose managers after updating the game
        InputManager.dispose()
        ShaderManager.dispose()
예제 #3
0
    def init():
        Logger.info("GameManager", "Created")

        # Init systems
        TextureManager.init()
        TextManager.init()
        InputManager.init(Config.inputs)
        GameManager.cam = camera.Camera(
            70.0,
            [0, 0, -2
             ])  # FOV 70, Precise position of cam to render 18 * 12 tiles
        ShaderManager.init()

        GameManager.setCurrentScreen("menuscreen", [True])
        GameManager.createCurrentScreen()
예제 #4
0
    def update(self):
        # Keys test
        if im.inputPressed(im.ESCAPE):
            from game.main.window import Window
            Window.exit()

        # Update button texture on hover
        self.returnMenu.update()
	def update(self):
		# Keys test
		if im.inputPressed(im.ESCAPE):
			self.inPause = not self.inPause

		if self.networkInfo[0]:
			self.updateMulti()
		else:
			self.updateLocal()
    def update(self):
        # Exit test
        if im.inputPressed(im.ESCAPE):
            from game.main.window import Window
            Window.exit()

        # Update buttons
        self.playLocal.update()
        if self.showCredits:
            self.hideCreditsBtn.update()
        else:
            self.showCreditsBtn.update()
        self.quit.update()