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

Change border colors on the minimap for moved units #3733

Merged
merged 4 commits into from
Jun 25, 2022
Merged
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
30 changes: 20 additions & 10 deletions megamek/src/megamek/client/ui/swing/minimap/Minimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -945,18 +945,28 @@ private void paintUnit(Graphics g, Entity entity) {

Path2D form = MinimapUnitSymbols.getForm(entity);

Color borderColor = Color.WHITE;
Color fontColor = Color.BLACK;
if (entity.moved != EntityMovementType.MOVE_NONE) {
borderColor = Color.BLACK;
}

float outerBorderWidth = 30f;
float innerBorderWidth = 20f;

if (stratOpsSymbols) {
// White border to set off the icon from the background
g2.setStroke(new BasicStroke(30f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
g2.setColor(new Color(255, 255, 255, 150));
g2.setStroke(new BasicStroke(outerBorderWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
g2.setColor(Color.BLACK);
g2.draw(STRAT_BASERECT);

// Black background to fill forms like the DropShip
g2.setColor(Color.BLACK);
g2.setColor(fontColor);
g2.fill(STRAT_BASERECT);

// Rectangle border for all units
g2.setStroke(new BasicStroke(8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
g2.setColor(borderColor);
g2.setStroke(new BasicStroke(innerBorderWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.draw(STRAT_BASERECT);

// Set a thin brush for filled areas (leave a thick brush for line symbols
Expand All @@ -970,7 +980,7 @@ private void paintUnit(Graphics g, Entity entity) {
g2.fill(form);

// Add the weight class or other lettering for certain units
g.setColor(Color.BLACK);
g.setColor(fontColor);
if ((entity instanceof Protomech) || (entity instanceof Mech) || (entity instanceof Aero)) {
String s = "";
if (entity instanceof Protomech) {
Expand All @@ -990,7 +1000,7 @@ private void paintUnit(Graphics g, Entity entity) {
(float) STRAT_SYMBOLSIZE.getHeight() / 3.0f));
}
} else if (entity instanceof MechWarrior) {
g2.setColor(Color.black);
g2.setColor(fontColor);
g2.fillOval(-25, -25, 50, 50);
}
// Draw the unit icon in black
Expand All @@ -999,17 +1009,17 @@ private void paintUnit(Graphics g, Entity entity) {
} else {
// Standard symbols
// White border to set off the icon from the background
g2.setStroke(new BasicStroke(30f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2.setColor(new Color(255, 255, 255, 150));
g2.setStroke(new BasicStroke(outerBorderWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2.setColor(Color.BLACK);
g2.draw(form);

// Fill the form in player color / team color
g.setColor(iconColor);
g2.fill(form);

// Black border
g2.setColor(Color.BLACK);
g2.setStroke(new BasicStroke(8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
g2.setColor(borderColor);
g2.setStroke(new BasicStroke(innerBorderWidth / 2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
g2.draw(form);
}

Expand Down