Class MinimapPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, IPreferenceChangeListener

public final class MinimapPanel extends JPanel implements IPreferenceChangeListener
Obviously, displays the map in scaled-down size. TBD: -move the buttons from graphics to real Swing buttons -clean up listenercode.. -initializecolors is fugly -uses break-to-label -uses while-true
See Also:
  • Field Details

  • Constructor Details

    • MinimapPanel

      public MinimapPanel(@Nullable MinimapDialog minimapDialog, Game game, @Nullable BoardView boardView, @Nullable IClientGUI clientGUI, @Nullable File minimapTheme, int boardId)
      Creates a minimap panel. The only required parameter is a game that contains the board to display. When the dialog is not null, it is assumed that this minimap will be visible for a while, and it will register itself to various objects as a listener to changes. When the dialog is null, it is assumed that the minimap is only used to create a snapshot image. When a BoardView is given, the visible area is shown.
  • Method Details

    • getMinimapImageMaxZoom

      public static BufferedImage getMinimapImageMaxZoom(Board board)
      Returns a minimap image of the given board at the maximum zoom index.
    • getMinimapImageMaxZoom

      public static BufferedImage getMinimapImageMaxZoom(Board board, @Nullable File minimapTheme)
      Returns a minimap image of the given board at the maximum zoom index.
    • getMinimapImage

      public static BufferedImage getMinimapImage(Board board, int zoom)
      Returns a minimap image of the given board at the given zoom index.
    • getMinimapImage

      public static BufferedImage getMinimapImage(Board board, int zoom, @Nullable File minimapTheme)
      Returns a minimap image of the given board at the given zoom index.
    • getMinimapImage

      public static BufferedImage getMinimapImage(Game game, BoardView boardView, int zoom, @Nullable File minimapTheme, int boardId)
      Returns a minimap image of the given board at the given zoom index. The game and BoardView object will be used to display additional information.
    • getMinimapImage

      public static BufferedImage getMinimapImage(Game game, BoardView boardView, int zoom, IClientGUI clientGui, @Nullable File minimapTheme, List<MinimapPanel.Line> movePathLines, int boardId)
      Returns a minimap image of the given board at the given zoom index. The game and BoardView object will be used to display additional information.
    • promptForGifRecordingConsent

      public static void promptForGifRecordingConsent(Game game, @Nullable Component parent)
      Prompts the local player, if necessary, whether to record this game's combat-summary GIF and stores the answer, so the per-phase recording never has to ask mid-game. This is the "at game start" entry point, intended to be called when the player readies up in the lobby.

      No-op unless the preference is GifRecordingMode.ASK and no decision has been made for this game yet, so it is safe to call every time the player toggles ready. Must be called on the event dispatch thread.

      Parameters:
      game - The game about to start
      parent - The parent component for the dialog, or null to center on screen
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • refreshMap

      public void refreshMap()
      Call this to schedule a minimap redraw.
    • changeColorForDestroyedUnit

      public static Color changeColorForDestroyedUnit(Color color, int alpha)
    • resetZoom

      public void resetZoom()
    • preferenceChange

      public void preferenceChange(PreferenceChangeEvent e)
      Specified by:
      preferenceChange in interface IPreferenceChangeListener