Class MapTabComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.gamearea.MapTabComponent
Component responsible for displaying and handling the game map when the player presses 'M'.
Displays the map texture, player location, landmarks and a legend.
The map maintains its aspect ratio and adjusts according to window size (sometimes).
Additionally, splits the map into three equal horizontal sections representing grass (bottom),
ocean (middle), and sky (top). Applies a blur effect to ocean and sky areas by default,
which can be toggled via (not yet implemented).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
static boolean
boolean
-
Constructor Summary
ConstructorsConstructorDescriptionMapTabComponent
(GameArea gameArea) Constructs a MapTabComponent associated with a specific GameArea. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Initialises the component, loading textures, fonts, and setting up initial data.void
dispose()
Disposes of all resources used by this component, including textures, batch, and fonts.void
drawMap()
Renders the map on the screen, including: - The map texture.void
setBlurOcean
(boolean blur) Sets whether to apply a blur effect on the ocean area of the map.void
setBlurSky
(boolean blur) Sets whether to apply a blur effect on the sky area of the map.void
update()
Handles input to toggle map visibility and close the map.Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Field Details
-
isMapVisible
public boolean isMapVisible -
blurOcean
public static boolean blurOcean -
blurSky
public static boolean blurSky
-
-
Constructor Details
-
MapTabComponent
Constructs a MapTabComponent associated with a specific GameArea.- Parameters:
gameArea
- The GameArea to which this map component belongs.
-
-
Method Details
-
create
public void create()Initialises the component, loading textures, fonts, and setting up initial data. -
update
public void update()Handles input to toggle map visibility and close the map. Also updates positions in case of window resize. -
drawMap
public void drawMap()Renders the map on the screen, including: - The map texture. - Player's current location. - Landmarks. - Legend displaying icons and their meanings. - A north symbol indicating the map orientation. - A top bar with the map title. The map maintains its aspect ratio and adjusts according to the current window size. If blurOcean or blurSky are enabled, respective areas of the map are overlaid with a blur effect. -
setBlurOcean
public void setBlurOcean(boolean blur) Sets whether to apply a blur effect on the ocean area of the map.- Parameters:
blur
- True to apply blur effect to the ocean, false to display the ocean normally.
-
setBlurSky
public void setBlurSky(boolean blur) Sets whether to apply a blur effect on the sky area of the map.- Parameters:
blur
- True to apply blur effect to the sky, false to display the sky normally.
-
dispose
public void dispose()Disposes of all resources used by this component, including textures, batch, and fonts.
-