Tweak name and ID overlay

This commit is contained in:
drdev
2014-05-25 14:53:29 +00:00
parent 5b0c83f65a
commit b1d03a85d5

View File

@@ -127,9 +127,9 @@ public class FCardPanel extends FDisplayObject {
Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b); Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT); color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT);
if (w < 200) { //only draw name and mana cost overlays if card is small if (h < Utils.AVG_FINGER_HEIGHT * 5) { //only draw name and mana cost overlays if card is small
if (showCardNameOverlay()) { if (showCardNameOverlay()) {
g.drawOutlinedText(card.getName(), FSkinFont.get(12), Color.WHITE, Color.BLACK, x, y + padding, w, h * 0.4f, true, HAlignment.LEFT, false); g.drawOutlinedText(card.getName(), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, HAlignment.LEFT, false);
} }
if (showCardManaCostOverlay()) { if (showCardManaCostOverlay()) {
float manaSymbolSize = w / 4; float manaSymbolSize = w / 4;
@@ -144,8 +144,10 @@ public class FCardPanel extends FDisplayObject {
} }
} }
if (showCardIdOverlay()) { if (showCardIdOverlay() && card.getUniqueNumber() > 0) {
drawIdBox(g, color, x, y, w, h); FSkinFont idFont = FSkinFont.forHeight(h * 0.12f);
float idHeight = idFont.getFont().getCapHeight();
g.drawOutlinedText(String.valueOf(card.getUniqueNumber()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, HAlignment.LEFT, false);
} }
int number = 0; int number = 0;
@@ -205,24 +207,6 @@ public class FCardPanel extends FDisplayObject {
} }
} }
private void drawIdBox(Graphics g, Color color, float x, float y, float w, float h) {
if (card.getUniqueNumber() <= 0) { return; }
String text = String.valueOf(card.getUniqueNumber());
FSkinFont font = FSkinFont.forHeight(h * 0.12f);
float padding = Math.round(font.getFont().getCapHeight() / 8);
float boxWidth = font.getFont().getBounds(text).width + 2 * padding;
float boxHeight = font.getFont().getCapHeight() + font.getFont().getAscent() + 2 * padding;
y += h - boxHeight;
w = boxWidth;
h = boxHeight;
g.fillRect(color, x, y, w, h);
g.drawRect(Utils.scaleMin(1), Color.BLACK, x, y, w, h);
g.drawText(text, font, Color.BLACK, Math.round(x) + padding, y, w, h, false, HAlignment.LEFT, true);
}
private void drawPtBox(Graphics g, Color color, float x, float y, float w, float h) { private void drawPtBox(Graphics g, Color color, float x, float y, float w, float h) {
//use array of strings to render separately with a tiny amount of space in between //use array of strings to render separately with a tiny amount of space in between
//instead of using actual spaces which are too wide //instead of using actual spaces which are too wide