diff --git a/forge-gui-mobile/src/forge/menu/FMenuTab.java b/forge-gui-mobile/src/forge/menu/FMenuTab.java index 52e3b8eeafc..accd52b6462 100644 --- a/forge-gui-mobile/src/forge/menu/FMenuTab.java +++ b/forge-gui-mobile/src/forge/menu/FMenuTab.java @@ -1,11 +1,13 @@ package forge.menu; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; + import forge.Forge.Graphics; import forge.assets.FSkinColor; import forge.assets.FSkinFont; import forge.assets.FSkinColor.Colors; import forge.toolbox.FDisplayObject; +import forge.util.Utils; public class FMenuTab extends FDisplayObject { private static final FSkinFont FONT = FSkinFont.get(12); @@ -14,6 +16,9 @@ public class FMenuTab extends FDisplayObject { private static final FSkinColor SEL_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor FORE_COLOR = SEL_FORE_COLOR.alphaColor(0.5f); private static final FSkinColor SEPARATOR_COLOR = SEL_FORE_COLOR.alphaColor(0.3f); + private static final float PADDING = Utils.scaleMin(2); + private static final float SEL_BORDER_WIDTH = Utils.scaleMin(2); + private static final float SEPARATOR_WIDTH = Utils.scaleX(1); private final FMenuBar menuBar; private final FDropDown dropDown; @@ -61,19 +66,17 @@ public class FMenuTab extends FDisplayObject { @Override public void draw(Graphics g) { float x, y, w, h; - float paddingX = 2; - float paddingY = 2; FSkinColor foreColor; if (dropDown.isVisible()) { - x = paddingX; //round so lines show up reliably - y = paddingY; + x = PADDING; //round so lines show up reliably + y = PADDING; w = getWidth() - 2 * x + 1; h = getHeight() - y + 1; g.startClip(x, y, w, h); g.fillRect(SEL_BACK_COLOR, x, y, w, h); - g.drawRect(2, SEL_BORDER_COLOR, x, y, w, h); + g.drawRect(SEL_BORDER_WIDTH, SEL_BORDER_COLOR, x, y, w, h); g.endClip(); foreColor = SEL_FORE_COLOR; @@ -85,12 +88,12 @@ public class FMenuTab extends FDisplayObject { //draw right separator x = getWidth(); y = getHeight() / 4; - g.drawLine(1, SEPARATOR_COLOR, x, y, x, getHeight() - y); + g.drawLine(SEPARATOR_WIDTH, SEPARATOR_COLOR, x, y, x, getHeight() - y); - x = paddingX; - y = paddingY; - w = getWidth() - 2 * paddingX; - h = getHeight() - 2 * paddingY; + x = PADDING; + y = PADDING; + w = getWidth() - 2 * PADDING; + h = getHeight() - 2 * PADDING; g.drawText(text, FONT, foreColor, x, y, w, h, false, HAlignment.CENTER, true); } } diff --git a/forge-gui-mobile/src/forge/screens/match/views/VManaPool.java b/forge-gui-mobile/src/forge/screens/match/views/VManaPool.java index f50ad18e3a0..082c9d4ad74 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VManaPool.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VManaPool.java @@ -99,10 +99,15 @@ public class VManaPool extends VDisplayArea { public void draw(Graphics g) { float textHeight = FONT.getFont().getCapHeight(); float gapY = textHeight / 4f; - float w = image.getWidth(); - float h = image.getHeight(); + + float maxImageHeight = getHeight() - textHeight - 3 * gapY; + float h = image.getNearestHQHeight(maxImageHeight); + if (h > maxImageHeight) { + h /= 2; + } + float w = image.getWidth() * h / image.getHeight(); float x = (getWidth() - w) / 2; - float y = (getHeight() - h - textHeight - gapY) / 2; + float y = gapY + (maxImageHeight - h) / 2; g.drawImage(image, x, y, w, h); diff --git a/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java b/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java index 8c4db931529..0f3eaee1780 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java @@ -18,12 +18,14 @@ import forge.screens.match.FControl; import forge.screens.match.MatchScreen; import forge.toolbox.FContainer; import forge.toolbox.FDisplayObject; +import forge.util.Utils; public class VPlayerPanel extends FContainer { private static final FSkinFont LIFE_FONT = FSkinFont.get(18); private static final FSkinFont INFO_FONT = FSkinFont.get(12); private static final FSkinColor INFO_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor DISPLAY_AREA_BACK_COLOR = FSkinColor.get(Colors.CLR_INACTIVE).alphaColor(0.5f); + private static final float INFO_TAB_PADDING = Utils.scaleMin(2); private final Player player; private final VPhaseIndicator phaseIndicator; @@ -240,8 +242,6 @@ public class VPlayerPanel extends FContainer { @Override public void draw(Graphics g) { float x, y, w, h; - float paddingX = 2; - float paddingY = 2; if (selectedTab == this) { y = 0; @@ -249,18 +249,18 @@ public class VPlayerPanel extends FContainer { h = getHeight(); float yAcross; if (isFlipped()) { - y += paddingY; + y += INFO_TAB_PADDING; yAcross = y; y--; h++; } else { - h -= paddingY; + h -= INFO_TAB_PADDING; yAcross = h; y--; h += 2; } - g.fillRect(DISPLAY_AREA_BACK_COLOR, 0, isFlipped() ? paddingY : 0, w, getHeight() - paddingY); + g.fillRect(DISPLAY_AREA_BACK_COLOR, 0, isFlipped() ? INFO_TAB_PADDING : 0, w, getHeight() - INFO_TAB_PADDING); g.startClip(-1, y, w + 2, h); //use clip to ensure all corners connect g.drawLine(1, MatchScreen.BORDER_COLOR, 0, yAcross, w, yAcross); g.drawLine(1, MatchScreen.BORDER_COLOR, 0, y, 0, h); @@ -268,13 +268,17 @@ public class VPlayerPanel extends FContainer { g.endClip(); } - h = Math.round(getHeight() * 0.7f / 20f) * 20f; //round to nearest 20 so images look ok - w = h; - x = paddingX; + float maxImageWidth = getWidth() - INFO_FONT.getFont().getBounds("0").width - 3 * INFO_TAB_PADDING; + w = icon.getNearestHQWidth(maxImageWidth); + if (w > maxImageWidth) { + w /= 2; + } + h = icon.getHeight() * w / icon.getWidth(); + x = INFO_TAB_PADDING; y = (getHeight() - h) / 2; g.drawImage(icon, x, y, w, h); - x += w * 1.1f; + x += w + INFO_TAB_PADDING; g.drawText(value, INFO_FONT, INFO_FORE_COLOR, x, 0, getWidth() - x + 1, getHeight(), false, HAlignment.LEFT, true); } }