Class MapDrawer

java.lang.Object
com.mg105.user_interface.MapDrawer
All Implemented Interfaces:
Toggleable, PropertyChangeListener, EventListener

public class MapDrawer extends Object implements PropertyChangeListener, Toggleable
MapDrawer draws the map as a grid of tiles.
  • Constructor Details

    • MapDrawer

      public MapDrawer(@NotNull @NotNull RoomInterpreterInterface interpreter)
      Create an instance of MapDrawer.
      Parameters:
      interpreter - the room interpreter used to format the data in an acceptable way for this class.
  • Method Details

    • getScene

      @NotNull public @NotNull javafx.scene.Scene getScene()
      Get the scene that will be used to draw to.
      Specified by:
      getScene in interface Toggleable
      Returns:
      the scene that the MapDrawer will draw to.
    • toggle

      public void toggle(boolean isVisible)
      Toggle the visibility of map drawer. In this case we need to make sure the map drawing is up-to-date.
      Specified by:
      toggle in interface Toggleable
      Parameters:
      isVisible - true if the map is now visible, false otherwise.
    • updateRoom

      public void updateRoom()
      Redraw the current room. This method only needs to be called if something has changed in the underlying current room.
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Update the current room based on evt.

      Note that none of the properties of evt are used.

      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      evt - A PropertyChangeEvent object describing the event source and the property that has changed.