Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show map size on mini map #4168

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,7 @@ Minimap.BuildingHeightLabel=B
Minimap.GroundHeightLabel=G
Minimap.NoHeightLabel=N
Minimap.TotalHeightLabel=T
Minimap.X=X

#Mini round report display
MiniReportDisplay.Damage=Damage
Expand Down
22 changes: 17 additions & 5 deletions megamek/src/megamek/client/ui/swing/minimap/Minimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
import java.util.List;
import java.util.*;

import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_BASERECT;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_CX;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_SYMBOLSIZE;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.*;
import static megamek.common.Terrains.*;

/**
Expand Down Expand Up @@ -711,7 +709,20 @@ private void drawButtons(Graphics g) {
default:
label = "";
}
g.drawString(label, 17, y0 + 12);
g.drawString(label, 17, y0 + 11);

// map size
int width = getFontMetrics(g.getFont()).stringWidth(label);
String mapSize = board.getWidth() + " " + Messages.getString("Minimap.X") + " " + board.getHeight();
int x = 24 + width;
g.drawString(mapSize, x, y0 + 11);
width = getFontMetrics(g.getFont()).stringWidth(mapSize);
x += width + 3;
g.setColor(Color.black);
g.drawLine(x, y0, x, h);
x += 1;
g.setColor(Color.green.darker());
g.drawLine(x, y0, x, h);
}
}
}
Expand All @@ -731,10 +742,11 @@ private void paintHeight(Graphics g, Hex h, int x, int y) {
height = (h.containsAnyTerrainOf(BUILDING, FUEL_TANK)) ? h.ceiling() : h.floor();
}
if (height != 0) {
String sHeight = ((height > -1) && (height < 10)) ? " " + height : height + "";
int baseX = (x * (HEX_SIDE[zoom] + HEX_SIDE_BY_SIN30[zoom])) + leftMargin;
int baseY = (((2 * y) + 1 + (x % 2)) * HEX_SIDE_BY_COS30[zoom]) + topMargin;
g.setColor(Color.white);
g.drawString(height + "", baseX + 5, baseY + 5);
g.drawString(sHeight, baseX + 5, baseY + 5);
}
}

Expand Down