Package de.tum.cit.ase.maze.screens
Class MiniMap
java.lang.Object
de.tum.cit.ase.maze.screens.MiniMap
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
The MiniMap class represents a mini map that can be displayed in a game screen.
It displays the visited and not visited tiles on the map, as well as the player's position.
The mini map can be zoomed in, zoomed out, or turned off.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Types that can be represented by the miniMapstatic enum
Represents the state of zoom in a mini map. -
Constructor Summary
ConstructorDescriptionMiniMap
(GameScreen game, com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch, Player player) Represents a minimap for the game. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
com.badlogic.gdx.utils.viewport.Viewport
void
render()
Renders the mini map on the screen.void
resize
(int width, int height) Resizes the mini map to the specified width and height.void
setZoomState
(MiniMap.ZoomState zoomState) void
Switches the zoom state of the mini map.void
update
(float dt) Updates the mini map based on the given delta time.
-
Constructor Details
-
MiniMap
public MiniMap(GameScreen game, com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch, Player player) Represents a minimap for the game.- Parameters:
game
- The game screen.spriteBatch
- The sprite batch used for rendering.player
- The player object.
-
-
Method Details
-
render
public void render()Renders the mini map on the screen. It applies the given viewport and sets the projection matrix of the sprite batch and shape renderer. -
update
public void update(float dt) Updates the mini map based on the given delta time.- Parameters:
dt
- the delta time.
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
resize
public void resize(int width, int height) Resizes the mini map to the specified width and height.- Parameters:
width
- The new width of the mini map.height
- The new height of the mini map.
-
switchZoom
public void switchZoom()Switches the zoom state of the mini map. -
getZoomState
-
getViewport
public com.badlogic.gdx.utils.viewport.Viewport getViewport() -
setZoomState
-