Skip to content

Commit

Permalink
feat: added a strike through units destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Feb 10, 2025
1 parent 36cd174 commit d52a540
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
20 changes: 12 additions & 8 deletions megamek/src/megamek/client/ui/swing/minimap/Minimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -1257,20 +1257,21 @@ private void paintUnit(Graphics g, Entity entity) {
g2.draw(STRAT_BASERECT);
g2.fill(STRAT_BASERECT);

g.setColor(fontColor);


// Set a thin brush for filled areas (leave a thick brush for line symbols
if ((entity instanceof Mek) || (entity instanceof ProtoMek)
|| (entity instanceof VTOL) || (entity.isAero())) {
g2.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
} else {
g2.setStroke(new BasicStroke(formStrokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
}

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

// Add the weight class or other lettering for certain units
g.setColor(fontColor);
g2.setColor(fontColor);
if ((entity instanceof ProtoMek) || (entity instanceof Mek) || (entity instanceof Aero)) {
String s = "";
if (entity instanceof ProtoMek) {
Expand All @@ -1297,10 +1298,7 @@ private void paintUnit(Graphics g, Entity entity) {
g2.setColor(fontColor);
g2.fillOval(-25, -25, 50, 50);
}
if (entity.isDestroyed()) {
g2.draw(STRAT_DESTROYED);
g2.fill(STRAT_DESTROYED);
}


// Draw the unit icon in black
g2.draw(form);
Expand All @@ -1318,7 +1316,7 @@ private void paintUnit(Graphics g, Entity entity) {
g2.draw(form);

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

// Black border
Expand Down Expand Up @@ -1346,6 +1344,12 @@ private void paintUnit(Graphics g, Entity entity) {
(float) -STRAT_SYMBOLSIZE.getHeight() / 5 * 4));

}
// If the unit is destroyed, it gets a strike on it.
if (entity.isDestroyed()) {
g2.setColor(fontColor);
g2.setStroke(new BasicStroke(formStrokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
g2.draw(STRAT_DESTROYED);
}

g2.setStroke(new BasicStroke(innerBorderWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public class MinimapUnitSymbols {
STRAT_DESTROYED.moveTo(-STRAT_SYMBOLSIZE.getWidth() / 2, 0);
STRAT_DESTROYED.lineTo(STRAT_SYMBOLSIZE.getWidth() / 2, 0);


STRAT_VTOL = new Path2D.Double();
STRAT_VTOL.append(STRAT_BASERECT, false);
STRAT_VTOL.moveTo(-STRAT_SYMBOLSIZE.getWidth() / 4, -STRAT_SYMBOLSIZE.getHeight() / 4);
Expand Down

0 comments on commit d52a540

Please sign in to comment.