All Implemented Interfaces:
GUIElement, ImageObserver, MenuContainer, Serializable

public class GUIMap extends AbstractGUIMap
Display the map view. It supports both normal-sized (32x32 pixel) and double sized (64x64 pixel) sized tiles.
See Also:
  • Constructor Details

    • GUIMap

      public GUIMap(boolean avoidCopyArea, @NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @NotNull @NotNull MapUpdaterState mapUpdaterState, @NotNull @NotNull FacesProvider facesProvider, @NotNull @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull @NotNull SmoothFaces smoothFaces, @NotNull @NotNull DarknessColors darknessColors, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      avoidCopyArea - whether map scrolling is done by copying pixel areas; if unset, always repaint all map squares
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      mapUpdaterState - the map updater state instance to use
      facesProvider - the faces provider for looking up faces
      crossfireServerConnection - the server connection to monitor
      smoothFaces - the smooth faces to use
      darknessColors - the darkness colors instance for converting darkness values into colors
      guiFactory - the global GUI factory instance
  • Method Details

    • paintSquareBackground

      protected void paintSquareBackground(@NotNull @NotNull Graphics g, int px, int py, boolean hasImage, @NotNull @NotNull CfMapSquare mapSquare)
      Description copied from class: AbstractGUIMap
      Paints the background of a map square.
      Specified by:
      paintSquareBackground in class AbstractGUIMap
      Parameters:
      g - the graphics to paint into
      px - the x-offset for painting
      py - the y-offset for painting
      hasImage - whether the square contains at least one image
      mapSquare - the map square
    • markPlayer

      protected void markPlayer(@NotNull @NotNull Graphics g, int dx, int dy)
      Description copied from class: AbstractGUIMap
      Paints the player location.
      Specified by:
      markPlayer in class AbstractGUIMap
      Parameters:
      g - the graphics to paint to
      dx - the x distance to map has just scrolled
      dy - the y distance to map has just scrolled
    • mouseClicked

      public void mouseClicked(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the user has clicked (pressed+released) this element. This event will be delivered after GUIElement.mouseReleased(MouseEvent).
      Specified by:
      mouseClicked in interface GUIElement
      Overrides:
      mouseClicked in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • getTooltip

      @Nullable public @Nullable TooltipText getTooltip()
      Description copied from class: AbstractGUIElement
      Returns the current tooltip text.
      Specified by:
      getTooltip in class AbstractGUIElement
      Returns:
      the tooltip text or null to not show a tooltip
    • notifyOpen

      public void notifyOpen()
      Description copied from interface: GUIElement
      Called each time the enclosing dialog is opened (or raised).
    • getPreferredSize

      @Nullable public @Nullable Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getPreferredMapWidth

      public int getPreferredMapWidth()
      Returns the minimal map width in squares needed to fill the map area.
      Returns:
      the map width in squares
    • getPreferredMapHeight

      public int getPreferredMapHeight()
      Returns the minimal map height in squares needed to fill the map area.
      Returns:
      the map height in squares