Class MapTabComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.gamearea.MapTabComponent

public class MapTabComponent extends Component
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 Details

    • isMapVisible

      public boolean isMapVisible
    • blurOcean

      public static boolean blurOcean
    • blurSky

      public static boolean blurSky
  • Constructor Details

    • MapTabComponent

      public MapTabComponent(GameArea gameArea)
      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.
      Overrides:
      create in class Component
    • update

      public void update()
      Handles input to toggle map visibility and close the map. Also updates positions in case of window resize.
      Overrides:
      update in class Component
    • 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.
      Overrides:
      dispose in class Component