mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* UI: added auto-size of PT box in mtgo render mode (large values are now visible);
This commit is contained in:
parent
5c48803ef9
commit
9518306016
2 changed files with 13 additions and 9 deletions
|
@ -221,7 +221,7 @@ public final class GuiDisplayUtil {
|
|||
if (card.getMageObjectType().isPermanent() && card instanceof PermanentView) {
|
||||
int damage = ((PermanentView) card).getDamage();
|
||||
if (damage > 0) {
|
||||
textLines.getLines().add("<span color='red'><b>Damage dealt:</b> " + damage + "</span>"); // TODO
|
||||
textLines.getLines().add("<span color='red'><b>Damage dealt:</b> " + damage + "</span>");
|
||||
textLines.setBasicTextLength(textLines.getBasicTextLength() + 50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -990,6 +990,18 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
// Is it a creature?
|
||||
boolean isVehicle = cardView.getSubTypes().contains(SubType.VEHICLE);
|
||||
if (cardView.isCreature() || isVehicle) {
|
||||
|
||||
// draws p/t by parts
|
||||
String ptText1 = cardView.getPower();
|
||||
String ptText2 = "/";
|
||||
String ptText3 = CardRendererUtils.getCardLifeWithDamage(cardView);
|
||||
int ptTextWidth1 = g.getFontMetrics(ptTextFont).stringWidth(ptText1);
|
||||
int ptTextWidth2 = g.getFontMetrics(ptTextFont).stringWidth(ptText2);
|
||||
|
||||
// PT max size
|
||||
int partMinWidth = g.getFontMetrics(ptTextFont).stringWidth(ptText1 + ptText2 + ptText3) + 2 * contentInset;
|
||||
partWidth = Math.max(partMinWidth, partWidth);
|
||||
|
||||
int x = cardWidth - borderWidth - partWidth;
|
||||
|
||||
// Draw PT box
|
||||
|
@ -1024,14 +1036,6 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
g.setColor(defaultTextColor);
|
||||
g.setFont(ptTextFont);
|
||||
|
||||
// draws p/t by parts
|
||||
String ptText1 = cardView.getPower();
|
||||
String ptText2 = "/";
|
||||
String ptText3 = CardRendererUtils.getCardLifeWithDamage(cardView);
|
||||
|
||||
int ptTextWidth1 = g.getFontMetrics().stringWidth(ptText1);
|
||||
int ptTextWidth2 = g.getFontMetrics().stringWidth(ptText2);
|
||||
|
||||
// draws / by center, P and T from left/right sides of /
|
||||
int ptCenterX = x + partWidth / 2;
|
||||
// p
|
||||
|
|
Loading…
Reference in a new issue