22 package com.realtime.crossfire.jxclient.gui.map;
30 import java.awt.Color;
31 import java.awt.Dimension;
32 import java.awt.Graphics;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
107 super(avoidCopyArea, tooltipManager, elementListener, name, mapUpdaterState, facesProvider, null, darknessColors);
111 tileSize = facesProvider.getSize();
123 final int colorIndex = mapSquare.getColor();
124 color = 0 <= colorIndex && colorIndex < TILE_COLORS.length ? TILE_COLORS[colorIndex] : Color.BLACK;
133 protected void markPlayer(@NotNull
final Graphics g,
final int dx,
final int dy) {
134 if (dx != 0 || dy != 0) {
137 final int mapSquareX = playerOffsetX-dx;
138 final int mapSquareY = playerOffsetY-dy;
145 g.setColor(Color.RED);
155 return new Dimension(width*tileSize, height*tileSize);
Listener for GUIElement related events.
static final long serialVersionUID
The serial version UID.
final TooltipManager tooltipManager
The TooltipManager to update.
Represents a square in a CfMap.
final boolean avoidCopyArea
Whether map scrolling is done by copying pixel areas.
CfMap getMap()
Returns the current map instance.
Represents a map (as seen by the client).
static final Color [] TILE_COLORS
The colors for displaying magic map data.
GUIMiniMap(final boolean avoidCopyArea, @NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final MapUpdaterState mapUpdaterState, @NotNull final FacesProvider facesProvider, @NotNull final DarknessColors darknessColors, final int width, final int height)
Creates a new instance.
int getMapHeight()
Returns the map height in squares.
CfMapSquare getMapSquare(final int x, final int y)
Returns a map square.
Implements the map model which is shown in the map and magic map views.
Manages image information ("faces") needed to display the map view, items, and spell icons...
Abstract base class for GUIElements that display map views.
final GUIElementListener elementListener
The GUIElementListener to notify.
void redrawSquare(@NotNull final Graphics g, @NotNull final CfMapSquare mapSquare, @NotNull final CfMap map, final int x, final int y)
Redraws one square.
void markPlayer(@NotNull final Graphics g, final int dx, final int dy)
final String name
The name of this element.
final int width
The map width in squares.
int getPlayerY()
Returns the y offset of the tile representing the player.
int getMapWidth()
Returns the map width in squares.
final MapUpdaterState mapUpdaterState
The MapUpdaterState instance to use.
final FacesProvider facesProvider
The FacesProvider for looking up faces.
Interface for face providers.
int getPlayerX()
Returns the x offset of the tile representing the player.
Update a CfMap model from protocol commands.
final int tileSize
The size of one tile.
final DarknessColors darknessColors
The DarknessColors instance for converting darkness values into colors.
final int height
The map height in squares.
void paintSquareBackground(@NotNull final Graphics g, final int px, final int py, final boolean hasImage, @NotNull final CfMapSquare mapSquare)
Dimension getPreferredSize()
void paintColoredSquare(@NotNull final Graphics g, @NotNull final Color color, final int x, final int y)
Fills a square with one Color.
Displays a small map view.
Utility class for converting darkness values into colors.