Exemplo n.º 1
0
    def update():
        if GameManager.wantChangeScreen:
            GameManager.createCurrentScreen()

        GameManager.currentScreen.update()

        # Dispose managers after updating the game
        InputManager.dispose()
        ShaderManager.dispose()
Exemplo n.º 2
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()
Exemplo n.º 3
0
    def display(transition):
        # Displays two parts for maps:
        # Displays fist layer 0 -> 3, then answers EntityManager to display entities and finally display layer 4 -> 7

        sm.updateLink("texture", "model", MapRender.model.matrix)
        tm.bind(MapRender.currentTileSet)
        MapRender.shapeDown.display()

        em.EntityManager.display()

        sm.updateLink("texture", "model", MapRender.model.matrix)
        tm.bind(MapRender.currentTileSet)
        MapRender.shapeUp.display()
        if transition:
            MapRender.transitionShape.display()
Exemplo n.º 4
0
    def setMapValues(vbo, ebo, mapValue, tilesPositon, vboCount, eboCount,
                     tileSet):
        MapRender.mapValues = mapValue
        MapRender.tilesPosition = tilesPositon
        MapRender.vbo = vbo
        MapRender.ebo = ebo
        MapRender.vboCount = vboCount
        MapRender.eboCount = eboCount
        MapRender.currentTileSet = tileSet

        MapRender.tWidth = len(MapRender.mapValues[0][0])
        MapRender.tHeight = len(MapRender.mapValues[0])
        width = MapRender.tWidth
        height = MapRender.tHeight

        # Set the camera position
        from game.screen import gamemanager
        cam = gamemanager.GameManager.cam

        cam.setPos([0, 0, cam.pos[2]])
        cam.setMaximum([width, height])

        # Set camera position according to the size of map
        # In x
        if width > 18:
            # Follow the player
            cam.track[0] = True
        else:
            # Don't move
            cam.track[0] = False
            cam.addPos([-width / 2, 0, 0])
        # In y
        if height > 12:
            # Follow the player
            cam.track[1] = True
        else:
            # Don't move
            cam.track[1] = False
            cam.addPos([0, -height / 2, 0])

        cam.goToEntity()
        sm.dispose()
        MapRender.change = [True, True]
        MapRender.dispose()
Exemplo n.º 5
0
    def init():
        # Images and json loading
        MapRender.loadTileSets()

        # Render's shapes loading
        MapRender.shapeUp = shape.Shape("texture", True)
        MapRender.shapeUp.setStorage(shape.Shape.STATIC_STORE,
                                     shape.Shape.STATIC_STORE)
        MapRender.shapeUp.setReading([3, 2])
        MapRender.shapeDown = shape.Shape("texture", True)
        MapRender.shapeDown.setStorage(shape.Shape.STATIC_STORE,
                                       shape.Shape.STATIC_STORE)
        MapRender.shapeDown.setReading([3, 2])

        MapRender.model = matrix4f.Matrix4f(True)
        sm.updateLink("texture", "model", MapRender.model.matrix)

        MapRender.transitionShape = guirenderer.GuiRenderer()
        MapRender.transitionShape.setImage([18, 12], "transition")
        MapRender.transitionShape.updateModel([9, 6])
Exemplo n.º 6
0
 def unload():
     GameManager.currentScreen.unload()
     ShaderManager.unload()
     TextureManager.unload()
Exemplo n.º 7
0
 def display(self):
     sm.updateLink("texture", "model", self.model.matrix)
     tm.bind(self.texKey)
     self.shape.display()
 def display(self):
     sm.updateLink(self.shaderName, "model", self.model.matrix)
     self.shape.display()
Exemplo n.º 9
0
    def display():
        sm.updateLink("texture-hud", "model", Hud.model.matrix)

        tm.bind("hud")
        Hud.shape.display()
Exemplo n.º 10
0
	def display(self):
		sm.updateLink("text-hud", "model", self.model.matrix)

		txm.bind(self.font)
		self.shape.display()