diff --git a/forge-gui-android/pom.xml b/forge-gui-android/pom.xml index 51824df3241..e57470c688c 100644 --- a/forge-gui-android/pom.xml +++ b/forge-gui-android/pom.xml @@ -7,7 +7,7 @@ jar -Xms128m -Xmx2048m - 1.5.28.003 + 1.5.28.004 diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index 3b523dfbbc2..60b27bca318 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -38,7 +38,7 @@ import forge.util.FileUtil; import forge.util.Utils; public class Forge implements ApplicationListener { - public static final String CURRENT_VERSION = "1.5.28.003"; + public static final String CURRENT_VERSION = "1.5.28.004"; private static final ApplicationListener app = new Forge(); private static Clipboard clipboard; diff --git a/forge-gui-mobile/src/forge/assets/FSkinFont.java b/forge-gui-mobile/src/forge/assets/FSkinFont.java index 5020687e74b..a53c06a2576 100644 --- a/forge-gui-mobile/src/forge/assets/FSkinFont.java +++ b/forge-gui-mobile/src/forge/assets/FSkinFont.java @@ -39,7 +39,7 @@ public class FSkinFont { } public static FSkinFont get(final int unscaledSize) { - return _get((int)Utils.scaleMax(unscaledSize)); + return _get((int)Utils.scale(unscaledSize)); } public static FSkinFont _get(final int scaledSize) { FSkinFont skinFont = fonts.get(scaledSize); diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index 62f7bdc2e6a..fcc4a79cc93 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -48,12 +48,12 @@ public class CardRenderer { public static final float NAME_BOX_TINT = 0.2f; public static final float TEXT_BOX_TINT = 0.1f; public static final float PT_BOX_TINT = 0.2f; - public static final float MANA_COST_PADDING = Utils.scaleMin(3); - public static final float SET_BOX_MARGIN = Utils.scaleMin(1); + public static final float MANA_COST_PADDING = Utils.scale(3); + public static final float SET_BOX_MARGIN = Utils.scale(1); public static final float MANA_SYMBOL_SIZE = FSkinImage.MANA_1.getNearestHQWidth(2 * (NAME_FONT.getCapHeight() - MANA_COST_PADDING)); - private static final float NAME_COST_THRESHOLD = Utils.scaleY(200); + private static final float NAME_COST_THRESHOLD = Utils.scale(200); public static final float BLACK_BORDER_THICKNESS_RATIO = 0.021f; - private static final float BORDER_THICKNESS = Utils.scaleMin(1); + private static final float BORDER_THICKNESS = Utils.scale(1); private static Color fromDetailColor(DetailColors detailColor) { return FSkinColor.fromRGB(detailColor.r, detailColor.g, detailColor.b); @@ -461,7 +461,7 @@ public class CardRenderer { g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h); float padX = TEXT_FONT.getCapHeight() / 2; - float padY = padX + Utils.scaleY(2); //add a little more vertical padding + float padY = padX + Utils.scale(2); //add a little more vertical padding x += padX; y += padY; w -= 2 * padX; @@ -553,7 +553,7 @@ public class CardRenderer { if (showCardManaCostOverlay(card)) { float manaSymbolSize = w / 4; if (card.isSplitCard() && card.hasAltState()) { - float dy = manaSymbolSize / 2 + Utils.scaleY(5); + float dy = manaSymbolSize / 2 + Utils.scale(5); drawManaCost(g, card.getOriginal().getManaCost(), x, y + dy, w, h, manaSymbolSize); drawManaCost(g, card.getAlternate().getManaCost(), x, y - dy, w, h, manaSymbolSize); } diff --git a/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java b/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java index 4174d427ba6..4eeff5a0df3 100644 --- a/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java +++ b/forge-gui-mobile/src/forge/deck/AddBasicLandsDialog.java @@ -51,7 +51,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; public class AddBasicLandsDialog extends FDialog { private static final float ADD_BTN_SIZE = Utils.AVG_FINGER_HEIGHT * 0.75f; - private static final float LAND_PANEL_PADDING = Utils.scaleY(3); + private static final float LAND_PANEL_PADDING = Utils.scale(3); private final Callback callback; diff --git a/forge-gui-mobile/src/forge/deck/FDeckChooser.java b/forge-gui-mobile/src/forge/deck/FDeckChooser.java index 23fe96a4567..16380637ef4 100644 --- a/forge-gui-mobile/src/forge/deck/FDeckChooser.java +++ b/forge-gui-mobile/src/forge/deck/FDeckChooser.java @@ -36,7 +36,7 @@ import java.util.Arrays; import java.util.List; public class FDeckChooser extends FScreen { - public static final float PADDING = Utils.scaleMin(5); + public static final float PADDING = Utils.scale(5); private FComboBox cmbDeckTypes; private DeckType selectedDeckType; diff --git a/forge-gui-mobile/src/forge/deck/FDeckEditor.java b/forge-gui-mobile/src/forge/deck/FDeckEditor.java index bfabbeb34de..f05f776a11b 100644 --- a/forge-gui-mobile/src/forge/deck/FDeckEditor.java +++ b/forge-gui-mobile/src/forge/deck/FDeckEditor.java @@ -174,7 +174,7 @@ public class FDeckEditor extends TabPageScreen { private FEventHandler saveHandler; protected final DeckHeader deckHeader = add(new DeckHeader()); - protected final FLabel lblName = deckHeader.add(new FLabel.Builder().font(FSkinFont.get(16)).insets(new Vector2(Utils.scaleX(5), 0)).build()); + protected final FLabel lblName = deckHeader.add(new FLabel.Builder().font(FSkinFont.get(16)).insets(new Vector2(Utils.scale(5), 0)).build()); private final FLabel btnSave = deckHeader.add(new FLabel.Builder().icon(FSkinImage.SAVE).align(HAlignment.CENTER).pressedColor(Header.BTN_PRESSED_COLOR).build()); private final FLabel btnMoreOptions = deckHeader.add(new FLabel.Builder().text("...").font(FSkinFont.get(20)).align(HAlignment.CENTER).pressedColor(Header.BTN_PRESSED_COLOR).build()); diff --git a/forge-gui-mobile/src/forge/deck/FVanguardChooser.java b/forge-gui-mobile/src/forge/deck/FVanguardChooser.java index e81baee89b1..3e0466cbd9c 100644 --- a/forge-gui-mobile/src/forge/deck/FVanguardChooser.java +++ b/forge-gui-mobile/src/forge/deck/FVanguardChooser.java @@ -13,7 +13,7 @@ import forge.util.Aggregates; import forge.util.Utils; public class FVanguardChooser extends FScreen { - public static final float PADDING = Utils.scaleMin(5); + public static final float PADDING = Utils.scale(5); private static final CardPool allHumanAvatars = new CardPool(); private static final CardPool allAiAvatars = new CardPool(); diff --git a/forge-gui-mobile/src/forge/error/BugReportDialog.java b/forge-gui-mobile/src/forge/error/BugReportDialog.java index 825a41233a4..1f67845ca9b 100644 --- a/forge-gui-mobile/src/forge/error/BugReportDialog.java +++ b/forge-gui-mobile/src/forge/error/BugReportDialog.java @@ -20,7 +20,7 @@ import forge.util.Callback; import forge.util.Utils; public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static boolean isOpen; public static void show(String title, String text, boolean showExitAppBtn) { @@ -110,7 +110,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s private static final FSkinColor BACK_COLOR = FSkinColor.get(Colors.CLR_ZEBRA); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS); - private static final float PADDING = Utils.scaleMin(3); + private static final float PADDING = Utils.scale(3); private final String text; diff --git a/forge-gui-mobile/src/forge/itemmanager/filters/ItemFilter.java b/forge-gui-mobile/src/forge/itemmanager/filters/ItemFilter.java index a93f3dea7c0..d4a4bd1ed86 100644 --- a/forge-gui-mobile/src/forge/itemmanager/filters/ItemFilter.java +++ b/forge-gui-mobile/src/forge/itemmanager/filters/ItemFilter.java @@ -11,7 +11,7 @@ import forge.util.Utils; public abstract class ItemFilter { - public static final float PADDING = Utils.scaleMax(3); + public static final float PADDING = Utils.scale(3); public static final FSkinFont DEFAULT_FONT = FSkinFont.get(11); protected final ItemManager itemManager; diff --git a/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java b/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java index 71ce3959679..6dbb4e51186 100644 --- a/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java +++ b/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java @@ -43,16 +43,16 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; public class ImageView extends ItemView { - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static final float PILE_SPACING_Y = 0.1f; private static final FSkinFont LABEL_FONT = FSkinFont.get(12); private static final FSkinColor GROUP_HEADER_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor GROUP_HEADER_LINE_COLOR = GROUP_HEADER_FORE_COLOR.alphaColor(0.5f); private static final FSkinFont GROUP_HEADER_FONT = LABEL_FONT; - private static final float GROUP_HEADER_HEIGHT = Utils.scaleY(19); - private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scaleX(6); - private static final float GROUP_HEADER_LINE_THICKNESS = Utils.scaleY(1); - private static final float SEL_BORDER_SIZE = Utils.scaleMax(1); + private static final float GROUP_HEADER_HEIGHT = Utils.scale(19); + private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scale(6); + private static final float GROUP_HEADER_LINE_THICKNESS = Utils.scale(1); + private static final float SEL_BORDER_SIZE = Utils.scale(1); private static final int MIN_COLUMN_COUNT = 1; private static final int MAX_COLUMN_COUNT = 10; @@ -102,7 +102,7 @@ public class ImageView extends ItemView { @Override protected void drawContent(Graphics g, float w, float h, final boolean pressed) { - float lineThickness = Utils.scaleMin(1); + float lineThickness = Utils.scale(1); float offset = 2 * lineThickness; float squareSize = Math.round(w / 2 - offset); if (squareSize % 2 == 1) { @@ -420,7 +420,7 @@ public class ImageView extends ItemView { float itemAreaWidth = getScroller().getWidth(); float groupWidth = itemAreaWidth - 2 * groupX; - float gap = (MAX_COLUMN_COUNT - columnCount) / 2 + Utils.scaleX(2); //more items per row == less gap between them + float gap = (MAX_COLUMN_COUNT - columnCount) / 2 + Utils.scale(2); //more items per row == less gap between them float itemWidth = (groupWidth + gap) / columnCount - gap; if (pileBy != null) { //if showing piles, make smaller so part of the next card is visible so it's obvious if scrolling is needed diff --git a/forge-gui-mobile/src/forge/menu/FMagnifyView.java b/forge-gui-mobile/src/forge/menu/FMagnifyView.java index 77d43c356b2..af20cfd2cb4 100644 --- a/forge-gui-mobile/src/forge/menu/FMagnifyView.java +++ b/forge-gui-mobile/src/forge/menu/FMagnifyView.java @@ -11,7 +11,7 @@ import forge.toolbox.FDisplayObject; import forge.util.Utils; public class FMagnifyView extends FDropDown { - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private FDisplayObject owner; private String text; diff --git a/forge-gui-mobile/src/forge/menu/FMenuTab.java b/forge-gui-mobile/src/forge/menu/FMenuTab.java index feeceb5d404..346affa8301 100644 --- a/forge-gui-mobile/src/forge/menu/FMenuTab.java +++ b/forge-gui-mobile/src/forge/menu/FMenuTab.java @@ -16,8 +16,8 @@ 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); - public static final float PADDING = Utils.scaleMin(2); - private static final float SEPARATOR_WIDTH = Utils.scaleX(1); + public static final float PADDING = Utils.scale(2); + private static final float SEPARATOR_WIDTH = Utils.scale(1); private final FMenuBar menuBar; private final FDropDown dropDown; diff --git a/forge-gui-mobile/src/forge/menu/FTooltip.java b/forge-gui-mobile/src/forge/menu/FTooltip.java index 94779eb5dcb..b524257ab12 100644 --- a/forge-gui-mobile/src/forge/menu/FTooltip.java +++ b/forge-gui-mobile/src/forge/menu/FTooltip.java @@ -15,7 +15,7 @@ import forge.util.Utils; public class FTooltip extends FDropDown { private static final FSkinFont FONT = FSkinFont.get(12); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private FDisplayObject owner; private float x, y; diff --git a/forge-gui-mobile/src/forge/screens/FScreen.java b/forge-gui-mobile/src/forge/screens/FScreen.java index a9bfd270cd0..20714923d16 100644 --- a/forge-gui-mobile/src/forge/screens/FScreen.java +++ b/forge-gui-mobile/src/forge/screens/FScreen.java @@ -94,7 +94,7 @@ public abstract class FScreen extends FContainer { public static final FSkinColor BTN_PRESSED_COLOR = TEXTURE_OVERLAY_COLOR.alphaColor(1f); public static final FSkinColor LINE_COLOR = BTN_PRESSED_COLOR.stepColor(-40); public static final FSkinColor BACK_COLOR = BTN_PRESSED_COLOR.stepColor(-80); - public static final float LINE_THICKNESS = Utils.scaleY(1); + public static final float LINE_THICKNESS = Utils.scale(1); public abstract float getPreferredHeight(); } @@ -158,7 +158,7 @@ public abstract class FScreen extends FContainer { } protected static class BackIcon implements FImage { - private static final float THICKNESS = Utils.scaleMax(3); + private static final float THICKNESS = Utils.scale(3); private static final FSkinColor COLOR = FSkinColor.get(Colors.CLR_TEXT); private final float width, height; diff --git a/forge-gui-mobile/src/forge/screens/LoadingOverlay.java b/forge-gui-mobile/src/forge/screens/LoadingOverlay.java index 1575117ba80..ca190bbdec2 100644 --- a/forge-gui-mobile/src/forge/screens/LoadingOverlay.java +++ b/forge-gui-mobile/src/forge/screens/LoadingOverlay.java @@ -9,13 +9,14 @@ import forge.assets.FSkinColor; import forge.assets.FSkinColor.Colors; import forge.assets.FSkinFont; import forge.assets.FSkinImage; -import forge.screens.home.HomeScreen; import forge.toolbox.FDialog; import forge.toolbox.FOverlay; import forge.util.ThreadUtil; import forge.util.Utils; public class LoadingOverlay extends FOverlay { + private static final float LOGO_SIZE_FACTOR = 0.7f; + private static final float INSETS_FACTOR = 0.025f; private static final FSkinFont FONT = FSkinFont.get(22); private static final FSkinColor BACK_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.75f); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); @@ -57,14 +58,14 @@ public class LoadingOverlay extends FOverlay { float x = insets; float w = getWidth() - 2 * insets; - float padding = w * HomeScreen.INSETS_FACTOR; - float logoSize = w * HomeScreen.LOGO_SIZE_FACTOR; + float padding = w * INSETS_FACTOR; + float logoSize = w * LOGO_SIZE_FACTOR; float fontHeight = FONT.getCapHeight(); float panelHeight = logoSize + fontHeight + 4 * padding; float y = (getHeight() - panelHeight) / 2; g.fillRect(BACK_COLOR, x, y, w, panelHeight); - g.drawRect(Utils.scaleMax(2), FORE_COLOR, x, y, w, panelHeight); + g.drawRect(Utils.scale(2), FORE_COLOR, x, y, w, panelHeight); y += padding; g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize); y += logoSize + padding; diff --git a/forge-gui-mobile/src/forge/screens/constructed/AvatarSelector.java b/forge-gui-mobile/src/forge/screens/constructed/AvatarSelector.java index 40a95081787..bf6c8b50ad8 100644 --- a/forge-gui-mobile/src/forge/screens/constructed/AvatarSelector.java +++ b/forge-gui-mobile/src/forge/screens/constructed/AvatarSelector.java @@ -35,7 +35,7 @@ public class AvatarSelector extends FScreen { Forge.openScreen(selector); } - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static final int COLUMNS = 4; private final int currentIndex; diff --git a/forge-gui-mobile/src/forge/screens/constructed/ConstructedScreen.java b/forge-gui-mobile/src/forge/screens/constructed/ConstructedScreen.java index ae439144c2b..8c1b86e2884 100644 --- a/forge-gui-mobile/src/forge/screens/constructed/ConstructedScreen.java +++ b/forge-gui-mobile/src/forge/screens/constructed/ConstructedScreen.java @@ -53,7 +53,7 @@ import forge.util.Utils; public class ConstructedScreen extends LaunchScreen { private static final ForgePreferences prefs = FModel.getPreferences(); - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static final int MAX_PLAYERS = 2; //8; //TODO: Support multiplayer private static final FSkinFont VARIANTS_FONT = FSkinFont.get(12); private static final FSkinFont LABEL_FONT = FSkinFont.get(14); diff --git a/forge-gui-mobile/src/forge/screens/home/HomeScreen.java b/forge-gui-mobile/src/forge/screens/home/HomeScreen.java index e135e80b0be..870305ced92 100644 --- a/forge-gui-mobile/src/forge/screens/home/HomeScreen.java +++ b/forge-gui-mobile/src/forge/screens/home/HomeScreen.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import forge.screens.FScreen; import forge.screens.LoadingOverlay; import forge.Forge; -import forge.Graphics; import forge.assets.FSkinImage; import forge.screens.constructed.ConstructedScreen; import forge.screens.draft.DraftScreen; @@ -17,11 +16,13 @@ import forge.screens.settings.SettingsScreen; import forge.toolbox.FButton; import forge.toolbox.FEvent; import forge.toolbox.FEvent.FEventHandler; +import forge.toolbox.FLabel; +import forge.util.Utils; public class HomeScreen extends FScreen { - public static final float LOGO_SIZE_FACTOR = 0.7f; - public static final float INSETS_FACTOR = 0.025f; - private static final float GAP_Y_FACTOR = 0.01f; + private static final float PADDING = Utils.scale(5); + + private final FLabel lblLogo = add(new FLabel.Builder().icon(FSkinImage.LOGO).iconInBackground().iconScaleFactor(1).build()); private final ArrayList buttons = new ArrayList(); public HomeScreen() { @@ -76,26 +77,24 @@ public class HomeScreen extends FScreen { @Override protected void doLayout(float startY, float width, float height) { - float x = width * INSETS_FACTOR; - float y = width * LOGO_SIZE_FACTOR + 2 * x; //start below background logo - float dy = height * GAP_Y_FACTOR; - float buttonWidth = width - 2 * x; - float buttonHeight = (height - y - x) / buttons.size() - dy; - dy += buttonHeight; + float buttonWidth = width - 2 * PADDING; + float buttonHeight = buttons.get(0).getFont().getCapHeight() * 3.5f; + float x = PADDING; + float y = height; + float dy = buttonHeight + PADDING; - for (FButton button : buttons) { - button.setBounds(x, y, buttonWidth, buttonHeight); - y += dy; + for (int i = buttons.size() - 1; i >= 0; i--) { + y -= dy; + buttons.get(i).setBounds(x, y, buttonWidth, buttonHeight); } - } - @Override - protected void drawBackground(Graphics g) { - super.drawBackground(g); - - float size = getWidth() * LOGO_SIZE_FACTOR; - float x = (getWidth() - size) / 2f; - float y = getWidth() * INSETS_FACTOR; - g.drawImage(FSkinImage.LOGO, x, y, size, size); + float logoSize = y - 2 * PADDING; + y = PADDING; + if (logoSize > buttonWidth) { + y += (logoSize - buttonWidth) / 2; + logoSize = buttonWidth; + } + x = (width - logoSize) / 2; + lblLogo.setBounds(x, y, logoSize, logoSize); } } diff --git a/forge-gui-mobile/src/forge/screens/match/TargetingOverlay.java b/forge-gui-mobile/src/forge/screens/match/TargetingOverlay.java index ca71d708089..e079b14b1ce 100644 --- a/forge-gui-mobile/src/forge/screens/match/TargetingOverlay.java +++ b/forge-gui-mobile/src/forge/screens/match/TargetingOverlay.java @@ -29,8 +29,8 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; public class TargetingOverlay { - private static final float BORDER_THICKNESS = Utils.scaleMin(1); - private static final float ARROW_THICKNESS = Utils.scaleMax(5); + private static final float BORDER_THICKNESS = Utils.scale(1); + private static final float ARROW_THICKNESS = Utils.scale(5); private static final float ARROW_SIZE = 3 * ARROW_THICKNESS; private static FSkinColor friendColor, foeColor; diff --git a/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java b/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java index 6486f56e301..d87180b2586 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VAssignDamage.java @@ -50,7 +50,7 @@ import java.util.Map; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; public class VAssignDamage extends FDialog { - private static final float CARD_GAP_X = Utils.scaleX(10); + private static final float CARD_GAP_X = Utils.scale(10); private static final float ADD_BTN_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f; private final Callback> callback; diff --git a/forge-gui-mobile/src/forge/screens/match/views/VLog.java b/forge-gui-mobile/src/forge/screens/match/views/VLog.java index 9996196499c..fa4ee83e87c 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VLog.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VLog.java @@ -19,7 +19,7 @@ import forge.util.Utils; import forge.view.IGameView; public class VLog extends FDropDown { - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static final FSkinFont FONT = FSkinFont.get(11); private static final FSkinColor ALT_ROW_COLOR = FSkinColor.get(Colors.CLR_ZEBRA); private static final FSkinColor ROW_COLOR = ALT_ROW_COLOR.darker(); diff --git a/forge-gui-mobile/src/forge/screens/match/views/VPhaseIndicator.java b/forge-gui-mobile/src/forge/screens/match/views/VPhaseIndicator.java index 7ce9ebbd05d..00dc485af98 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VPhaseIndicator.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VPhaseIndicator.java @@ -18,8 +18,8 @@ import forge.util.Utils; public class VPhaseIndicator extends FContainer { private static final FSkinFont BASE_FONT = FSkinFont.get(11); - private static final float PADDING_X = Utils.scaleX(1); - private static final float PADDING_Y = Utils.scaleY(2); + private static final float PADDING_X = Utils.scale(1); + private static final float PADDING_Y = Utils.scale(2); private final Map phaseLabels = new HashMap(); private FSkinFont font; 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 2a6ea7f14f5..6f6306771b9 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VPlayerPanel.java @@ -29,8 +29,8 @@ public class VPlayerPanel extends FContainer { 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_X = Utils.scaleX(2); - private static final float INFO_TAB_PADDING_Y = Utils.scaleY(2); + private static final float INFO_TAB_PADDING_X = Utils.scale(2); + private static final float INFO_TAB_PADDING_Y = Utils.scale(2); private final PlayerView player; private final VPhaseIndicator phaseIndicator; @@ -304,7 +304,7 @@ public class VPlayerPanel extends FContainer { } else { float halfHeight = getHeight() / 2; - float textStart = halfHeight + Utils.scaleX(1); + float textStart = halfHeight + Utils.scale(1); float textWidth = getWidth() - textStart; g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight); g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, HAlignment.CENTER, true); diff --git a/forge-gui-mobile/src/forge/screens/match/views/VPlayers.java b/forge-gui-mobile/src/forge/screens/match/views/VPlayers.java index c87d49ab2d0..37729933755 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VPlayers.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VPlayers.java @@ -44,7 +44,7 @@ public class VPlayers extends FDropDown { private static class PlayerInfoPanel extends FContainer { private static final FSkinFont FONT = FSkinFont.get(12); - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 1.8f; private final PlayerView player; diff --git a/forge-gui-mobile/src/forge/screens/match/views/VPrompt.java b/forge-gui-mobile/src/forge/screens/match/views/VPrompt.java index f6251393737..48258e61c35 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VPrompt.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VPrompt.java @@ -21,11 +21,11 @@ import forge.util.Utils; public class VPrompt extends FContainer { public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT; public static final float BTN_WIDTH = HEIGHT * 1.5f; - public static final float PADDING = Utils.scaleMin(2); + public static final float PADDING = Utils.scale(2); + private static final FSkinFont FONT = FSkinFont.get(14); private static final FSkinColor BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final FSkinFont FONT = FSkinFont.get(14); private final FButton btnOk, btnCancel; private final MessageLabel lblMessage; diff --git a/forge-gui-mobile/src/forge/screens/match/views/VStack.java b/forge-gui-mobile/src/forge/screens/match/views/VStack.java index 1214033d211..4330f772b6e 100644 --- a/forge-gui-mobile/src/forge/screens/match/views/VStack.java +++ b/forge-gui-mobile/src/forge/screens/match/views/VStack.java @@ -40,9 +40,9 @@ import forge.view.StackItemView; public class VStack extends FDropDown { public static final float CARD_WIDTH = Utils.AVG_FINGER_WIDTH; public static final float CARD_HEIGHT = Math.round(CARD_WIDTH * FCardPanel.ASPECT_RATIO); - public static final float BORDER_THICKNESS = Utils.scaleMin(2); - public static final float PADDING = Utils.scaleMin(3); - public static final float MARGINS = Utils.scaleMin(4); + public static final float BORDER_THICKNESS = Utils.scale(2); + public static final float PADDING = Utils.scale(3); + public static final float MARGINS = Utils.scale(4); private static final FSkinFont FONT = FSkinFont.get(11); private static final float ALPHA_COMPOSITE = 0.5f; private static final TextRenderer textRenderer = new TextRenderer(true); diff --git a/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java b/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java index 92add105556..cb0b30c33a8 100644 --- a/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java +++ b/forge-gui-mobile/src/forge/screens/match/winlose/ViewWinLose.java @@ -189,7 +189,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView { } private static class OutcomesPanel extends FContainer { - private static final float LBL_HEIGHT = Utils.scaleY(20); + private static final float LBL_HEIGHT = Utils.scale(20); @Override protected void doLayout(float width, float height) { diff --git a/forge-gui-mobile/src/forge/screens/quest/LoadQuestScreen.java b/forge-gui-mobile/src/forge/screens/quest/LoadQuestScreen.java index 95045ffe338..4416dd6e2e2 100644 --- a/forge-gui-mobile/src/forge/screens/quest/LoadQuestScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/LoadQuestScreen.java @@ -271,8 +271,8 @@ public class LoadQuestScreen extends FScreen { h += SettingsScreen.SETTING_PADDING; y += h; h = totalHeight - h + w * SettingsScreen.INSETS_FACTOR; - float iconSize = h + Utils.scaleMin(1); - float iconOffset = SettingsScreen.SETTING_PADDING - Utils.scaleX(2); + float iconSize = h + Utils.scale(1); + float iconOffset = SettingsScreen.SETTING_PADDING - Utils.scale(2); String cards = String.valueOf(value.getAssets().getCardPool().countAll()); String credits = String.valueOf(value.getAssets().getCredits()); diff --git a/forge-gui-mobile/src/forge/screens/quest/QuestBazaarScreen.java b/forge-gui-mobile/src/forge/screens/quest/QuestBazaarScreen.java index fef61ff6bdd..c91c92c738d 100644 --- a/forge-gui-mobile/src/forge/screens/quest/QuestBazaarScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/QuestBazaarScreen.java @@ -49,7 +49,7 @@ public class QuestBazaarScreen extends TabPageScreen { } private static class BazaarPage extends TabPage { - private static final float PADDING = Utils.scaleMax(5); + private static final float PADDING = Utils.scale(5); private final QuestStallDefinition stallDef; private final FLabel lblStallName = add(new FLabel.Builder().text("").align(HAlignment.CENTER).build()); diff --git a/forge-gui-mobile/src/forge/screens/quest/QuestEventPanel.java b/forge-gui-mobile/src/forge/screens/quest/QuestEventPanel.java index 4873fbd96dd..08c385cb956 100644 --- a/forge-gui-mobile/src/forge/screens/quest/QuestEventPanel.java +++ b/forge-gui-mobile/src/forge/screens/quest/QuestEventPanel.java @@ -30,7 +30,7 @@ class QuestEventPanel extends FDisplayObject { private static final FSkinFont DESC_FONT = FSkinFont.get(12); private static final FSkinColor TITLE_COLOR = FList.FORE_COLOR; private static final FSkinColor DESC_COLOR = SettingsScreen.DESC_COLOR; - private static final float PADDING = Utils.scaleMax(5); + private static final float PADDING = Utils.scale(5); private static final FSkinColor GRADIENT_LEFT_COLOR = FSkinColor.get(Colors.CLR_THEME2).alphaColor(200 / 255f); private static final Color GRADIENT_RIGHT_COLOR = new Color(1, 1, 0, 0); private static final float RADIO_BUTTON_RADIUS = Utils.AVG_FINGER_WIDTH / 4; @@ -108,7 +108,7 @@ class QuestEventPanel extends FDisplayObject { //draw radio button x = getWidth() - PADDING - RADIO_BUTTON_RADIUS; y = h / 2; - g.drawCircle(Utils.scaleMin(1), SettingsScreen.DESC_COLOR, x, y, RADIO_BUTTON_RADIUS); + g.drawCircle(Utils.scale(1), SettingsScreen.DESC_COLOR, x, y, RADIO_BUTTON_RADIUS); if (isSelected()) { g.fillCircle(TITLE_COLOR, x, y, RADIO_BUTTON_RADIUS / 2); } diff --git a/forge-gui-mobile/src/forge/screens/quest/QuestPrefsScreen.java b/forge-gui-mobile/src/forge/screens/quest/QuestPrefsScreen.java index 8cdc5f195bf..9f198923e9f 100644 --- a/forge-gui-mobile/src/forge/screens/quest/QuestPrefsScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/QuestPrefsScreen.java @@ -19,7 +19,7 @@ import forge.toolbox.FTextField; import forge.util.Utils; public class QuestPrefsScreen extends FScreen { - private static final float PADDING = Utils.scaleMin(5); + private static final float PADDING = Utils.scale(5); private enum PrefsGroup { REWARDS, diff --git a/forge-gui-mobile/src/forge/screens/quest/QuestSpellShopScreen.java b/forge-gui-mobile/src/forge/screens/quest/QuestSpellShopScreen.java index 8932c6acf29..71c71c03eae 100644 --- a/forge-gui-mobile/src/forge/screens/quest/QuestSpellShopScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/QuestSpellShopScreen.java @@ -153,7 +153,7 @@ public class QuestSpellShopScreen extends TabPageScreen { @Override protected void doLayout(float width, float height) { - float y = Utils.scaleY(2); //move credits label down a couple pixels so it looks better + float y = Utils.scale(2); //move credits label down a couple pixels so it looks better float halfWidth = width / 2; lblCredits.setBounds(0, y, halfWidth, lblCredits.getAutoSizeBounds().height); getSecondLabel().setBounds(halfWidth, y, halfWidth, lblCredits.getHeight()); diff --git a/forge-gui-mobile/src/forge/screens/quest/QuestStatsScreen.java b/forge-gui-mobile/src/forge/screens/quest/QuestStatsScreen.java index d0ebd5aa224..df1f34220a0 100644 --- a/forge-gui-mobile/src/forge/screens/quest/QuestStatsScreen.java +++ b/forge-gui-mobile/src/forge/screens/quest/QuestStatsScreen.java @@ -98,7 +98,7 @@ public class QuestStatsScreen extends FScreen { public QuestStatsScreen() { super("Quest Statistics", QuestMenu.getMenu()); - lblZep.setHeight(Utils.scaleY(60)); + lblZep.setHeight(Utils.scale(60)); cbxPet.setDropDownChangeHandler(new FEventHandler() { @Override diff --git a/forge-gui-mobile/src/forge/screens/settings/AchievementsPage.java b/forge-gui-mobile/src/forge/screens/settings/AchievementsPage.java index 91a4b97310b..6a3c5c74981 100644 --- a/forge-gui-mobile/src/forge/screens/settings/AchievementsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/AchievementsPage.java @@ -25,8 +25,8 @@ import forge.util.Utils; public class AchievementsPage extends TabPage { private static final float TROPHY_PADDING = 45; - private static final float PADDING = Utils.scaleMin(5); - private static final float SELECTED_BORDER_THICKNESS = Utils.scaleMin(1); + private static final float PADDING = Utils.scale(5); + private static final float SELECTED_BORDER_THICKNESS = Utils.scale(1); private static final int MIN_SHELVES = 4; private static final int TROPHIES_PER_SHELVE = 4; private static final FSkinFont NAME_FONT = FSkinFont.get(14); diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index eb1c39f25a1..158204c6527 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -307,7 +307,7 @@ public class SettingsPage extends TabPage { float radius = h / 3; x += w - radius; y += h / 2; - g.drawCircle(Utils.scaleMin(1), SettingsScreen.DESC_COLOR, x, y, radius); + g.drawCircle(Utils.scale(1), SettingsScreen.DESC_COLOR, x, y, radius); if (value.equals(currentValue)) { g.fillCircle(foreColor, x, y, radius / 2); } diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsScreen.java b/forge-gui-mobile/src/forge/screens/settings/SettingsScreen.java index 5279529ead0..f4070239ae9 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsScreen.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsScreen.java @@ -11,8 +11,8 @@ public class SettingsScreen extends TabPageScreen { public static final float INSETS_FACTOR = 0.025f; public static final FSkinFont DESC_FONT = FSkinFont.get(11); public static final FSkinColor DESC_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.5f); - public static final float SETTING_HEIGHT = Utils.AVG_FINGER_HEIGHT + Utils.scaleY(12); - public static final float SETTING_PADDING = Utils.scaleY(5); + public static final float SETTING_HEIGHT = Utils.AVG_FINGER_HEIGHT + Utils.scale(12); + public static final float SETTING_PADDING = Utils.scale(5); private static SettingsScreen settingsScreen; //keep settings screen around so scroll positions maintained diff --git a/forge-gui-mobile/src/forge/toolbox/FButton.java b/forge-gui-mobile/src/forge/toolbox/FButton.java index 4540901c932..44958547a99 100644 --- a/forge-gui-mobile/src/forge/toolbox/FButton.java +++ b/forge-gui-mobile/src/forge/toolbox/FButton.java @@ -20,7 +20,7 @@ import forge.util.Utils; public class FButton extends FDisplayObject implements IButton { private static final FSkinColor DEFAULT_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final float PADDING = Utils.scaleX(10); + private static final float PADDING = Utils.scale(10); private FSkinImage imgL, imgM, imgR; private String text; diff --git a/forge-gui-mobile/src/forge/toolbox/FCardPanel.java b/forge-gui-mobile/src/forge/toolbox/FCardPanel.java index 23b758ba77f..6c3b7f1dc01 100644 --- a/forge-gui-mobile/src/forge/toolbox/FCardPanel.java +++ b/forge-gui-mobile/src/forge/toolbox/FCardPanel.java @@ -8,7 +8,7 @@ import forge.view.CardView; public class FCardPanel extends FDisplayObject { public static final float TAPPED_ANGLE = -90; public static final float ASPECT_RATIO = 3.5f / 2.5f; - public static final float PADDING = Utils.scaleMin(2); + public static final float PADDING = Utils.scale(2); public static final float TARGET_ORIGIN_FACTOR_X = 0.15f; public static final float TARGET_ORIGIN_FACTOR_Y = 0.5f; diff --git a/forge-gui-mobile/src/forge/toolbox/FCheckBox.java b/forge-gui-mobile/src/forge/toolbox/FCheckBox.java index 47b37914673..e6d684d4429 100644 --- a/forge-gui-mobile/src/forge/toolbox/FCheckBox.java +++ b/forge-gui-mobile/src/forge/toolbox/FCheckBox.java @@ -12,7 +12,7 @@ import forge.util.Utils; public class FCheckBox extends FLabel implements ICheckBox { private static final FSkinColor CHECK_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor BOX_COLOR = CHECK_COLOR.alphaColor(0.5f); - private static final float EXTRA_GAP = Utils.scaleX(3); + private static final float EXTRA_GAP = Utils.scale(3); public FCheckBox() { this("", false); @@ -56,15 +56,15 @@ public class FCheckBox extends FLabel implements ICheckBox { drawCheckBox(g, BOX_COLOR, CHECK_COLOR, isChecked, x, y, w, h); } public static void drawCheckBox(Graphics g, FSkinColor boxColor, FSkinColor checkColor, boolean isChecked, float x, float y, float w, float h) { - g.drawRect(Utils.scaleMin(1), boxColor, x, y, w, h); + g.drawRect(Utils.scale(1), boxColor, x, y, w, h); if (isChecked) { //draw check mark - float padX = Utils.scaleX(3); - float thickness = Utils.scaleMin(2); + float padX = Utils.scale(3); + float thickness = Utils.scale(2); x += padX; - y += Utils.scaleY(1); + y += Utils.scale(1); w -= 2 * padX; - h -= Utils.scaleY(3); + h -= Utils.scale(3); g.drawLine(thickness, checkColor, x, y + h / 2, x + w / 2, y + h); g.drawLine(thickness, checkColor, x + w / 2, y + h, x + w, y); } diff --git a/forge-gui-mobile/src/forge/toolbox/FDialog.java b/forge-gui-mobile/src/forge/toolbox/FDialog.java index 27187c4e11b..9ee1e6f87aa 100644 --- a/forge-gui-mobile/src/forge/toolbox/FDialog.java +++ b/forge-gui-mobile/src/forge/toolbox/FDialog.java @@ -18,7 +18,7 @@ public abstract class FDialog extends FOverlay { private static final FSkinColor TITLE_BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2); private static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS); public static final float TITLE_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.6f); - public static final float INSETS = Utils.scaleMin(10); + public static final float INSETS = Utils.scale(10); private static int openDialogCount = 0; public static boolean isDialogOpen() { diff --git a/forge-gui-mobile/src/forge/toolbox/FFileChooser.java b/forge-gui-mobile/src/forge/toolbox/FFileChooser.java index 43bef5b7023..ae3c603e6ee 100644 --- a/forge-gui-mobile/src/forge/toolbox/FFileChooser.java +++ b/forge-gui-mobile/src/forge/toolbox/FFileChooser.java @@ -22,7 +22,7 @@ import forge.util.FileUtil; import forge.util.Utils; public class FFileChooser extends FDialog { - private static final float BACK_ICON_THICKNESS = Utils.scaleMax(2); + private static final float BACK_ICON_THICKNESS = Utils.scale(2); public enum ChoiceType { OpenFile, diff --git a/forge-gui-mobile/src/forge/toolbox/FLabel.java b/forge-gui-mobile/src/forge/toolbox/FLabel.java index 199c5c3750e..b525dd26386 100644 --- a/forge-gui-mobile/src/forge/toolbox/FLabel.java +++ b/forge-gui-mobile/src/forge/toolbox/FLabel.java @@ -23,7 +23,7 @@ public class FLabel extends FDisplayObject implements IButton { private FSkinFont bldFont = FSkinFont.get(14); private float bldAlphaComposite = 0.7f; private HAlignment bldAlignment = HAlignment.LEFT; - private Vector2 bldInsets = new Vector2(Utils.scaleX(3), Utils.scaleY(3)); + private Vector2 bldInsets = new Vector2(Utils.scale(3), Utils.scale(3)); private boolean bldSelectable = false; private boolean bldSelected = false; @@ -90,7 +90,7 @@ public class FLabel extends FDisplayObject implements IButton { private static final FSkinColor d10 = clrMain.stepColor(-10); private static final FSkinColor l10 = clrMain.stepColor(10); private static final FSkinColor l20 = clrMain.stepColor(20); - public static final float BORDER_THICKNESS = Utils.scaleMin(1); + public static final float BORDER_THICKNESS = Utils.scale(1); private float iconScaleFactor; private FSkinFont font; @@ -293,8 +293,8 @@ public class FLabel extends FDisplayObject implements IButton { w -= 2 * x; h -= 2 * y; if (pressed) { //while pressed, translate graphics so icon and text appear shifted down and to the right - x += Utils.scaleX(1); - y += Utils.scaleY(1); + x += Utils.scale(1); + y += Utils.scale(1); } if (icon != null) { diff --git a/forge-gui-mobile/src/forge/toolbox/FList.java b/forge-gui-mobile/src/forge/toolbox/FList.java index 0fd55e23e81..982e1d1967b 100644 --- a/forge-gui-mobile/src/forge/toolbox/FList.java +++ b/forge-gui-mobile/src/forge/toolbox/FList.java @@ -17,11 +17,11 @@ import forge.screens.FScreen; import forge.util.Utils; public class FList extends FScrollPane implements Iterable { - public static final float PADDING = Utils.scaleMin(3); + public static final float PADDING = Utils.scale(3); public static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); public static final FSkinColor PRESSED_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.9f); public static final FSkinColor LINE_COLOR = FORE_COLOR.alphaColor(0.5f); - public static final float LINE_THICKNESS = Utils.scaleY(1); + public static final float LINE_THICKNESS = Utils.scale(1); private final List items = new ArrayList(); private FSkinFont font; diff --git a/forge-gui-mobile/src/forge/toolbox/FOptionPane.java b/forge-gui-mobile/src/forge/toolbox/FOptionPane.java index ff9a014453f..fd6de957421 100644 --- a/forge-gui-mobile/src/forge/toolbox/FOptionPane.java +++ b/forge-gui-mobile/src/forge/toolbox/FOptionPane.java @@ -23,11 +23,11 @@ public class FOptionPane extends FDialog { public static final FSkinImage WARNING_ICON = FSkinImage.WARNING; public static final FSkinImage ERROR_ICON = FSkinImage.ERROR; - public static final float PADDING = Utils.scaleMin(10); - public static final float GAP_BETWEEN_BUTTONS = Utils.scaleX(3); + public static final float PADDING = Utils.scale(10); + public static final float GAP_BETWEEN_BUTTONS = Utils.scale(3); public static final float GAP_BELOW_BUTTONS = PADDING * 0.5f; public static final float BUTTON_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f; - public static final float MIN_BUTTON_WIDTH = Utils.scaleX(120); + public static final float MIN_BUTTON_WIDTH = Utils.scale(120); public static float getMaxDisplayObjHeight() { return Forge.getCurrentScreen().getHeight() - 2 * VPrompt.HEIGHT - FDialog.TITLE_HEIGHT - @@ -255,7 +255,7 @@ public class FOptionPane extends FDialog { float promptHeight = 0; if (lblIcon != null) { - float labelWidth = Utils.scaleX(lblIcon.getIcon().getWidth()); + float labelWidth = Utils.scale(lblIcon.getIcon().getWidth()); promptHeight = lblIcon.getIcon().getHeight() * labelWidth / lblIcon.getIcon().getWidth(); if (promptHeight > maxPromptHeight) { promptHeight = maxPromptHeight; @@ -265,7 +265,7 @@ public class FOptionPane extends FDialog { y += promptHeight + PADDING; } else { - lblIcon.setBounds(x - Utils.scaleX(3), y, labelWidth, promptHeight); + lblIcon.setBounds(x - Utils.scale(3), y, labelWidth, promptHeight); x += labelWidth; } } diff --git a/forge-gui-mobile/src/forge/toolbox/FProgressBar.java b/forge-gui-mobile/src/forge/toolbox/FProgressBar.java index 66de432ee24..ef06f242c6a 100644 --- a/forge-gui-mobile/src/forge/toolbox/FProgressBar.java +++ b/forge-gui-mobile/src/forge/toolbox/FProgressBar.java @@ -175,6 +175,6 @@ public class FProgressBar extends FDisplayObject implements IProgressBar { } //draw border - g.drawRect(Utils.scaleMin(1), Color.BLACK, 0, 0, w, h); + g.drawRect(Utils.scale(1), Color.BLACK, 0, 0, w, h); } } diff --git a/forge-gui-mobile/src/forge/toolbox/FRadioButton.java b/forge-gui-mobile/src/forge/toolbox/FRadioButton.java index 4c42b4967a8..88144294fbb 100644 --- a/forge-gui-mobile/src/forge/toolbox/FRadioButton.java +++ b/forge-gui-mobile/src/forge/toolbox/FRadioButton.java @@ -14,7 +14,7 @@ import forge.util.Utils; public class FRadioButton extends FLabel { private static final FSkinColor INNER_CIRCLE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor OUTER_CIRCLE_COLOR = INNER_CIRCLE_COLOR.alphaColor(0.5f); - private static final float EXTRA_GAP = Utils.scaleX(3); + private static final float EXTRA_GAP = Utils.scale(3); private RadioButtonGroup group; @@ -81,7 +81,7 @@ public class FRadioButton extends FLabel { float radius = h / 3; x += w - radius; y += h / 2; - g.drawCircle(Utils.scaleMin(1), OUTER_CIRCLE_COLOR, x, y, radius); + g.drawCircle(Utils.scale(1), OUTER_CIRCLE_COLOR, x, y, radius); if (isSelected()) { g.fillCircle(INNER_CIRCLE_COLOR, x, y, radius / 2); } diff --git a/forge-gui-mobile/src/forge/toolbox/FScrollPane.java b/forge-gui-mobile/src/forge/toolbox/FScrollPane.java index 29a03390118..f3e8f12fa1a 100644 --- a/forge-gui-mobile/src/forge/toolbox/FScrollPane.java +++ b/forge-gui-mobile/src/forge/toolbox/FScrollPane.java @@ -12,8 +12,8 @@ import forge.util.Utils; public abstract class FScrollPane extends FContainer { private static final float FLING_DECEL = 750f; /*private static final FSkinColor INDICATOR_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.7f); - private static final float INDICATOR_SIZE = Utils.scaleMax(5); - private static final float INDICATOR_MARGIN = Utils.scaleMax(3);*/ + private static final float INDICATOR_SIZE = Utils.scale(5); + private static final float INDICATOR_MARGIN = Utils.scale(3);*/ private float scrollLeft, scrollTop; private ScrollBounds scrollBounds; diff --git a/forge-gui-mobile/src/forge/toolbox/FTextField.java b/forge-gui-mobile/src/forge/toolbox/FTextField.java index 6f94b42bb0d..9ff628752e1 100644 --- a/forge-gui-mobile/src/forge/toolbox/FTextField.java +++ b/forge-gui-mobile/src/forge/toolbox/FTextField.java @@ -17,8 +17,8 @@ import forge.util.Utils; public class FTextField extends FDisplayObject implements ITextField { private static final FSkinFont DEFAULT_FONT = FSkinFont.get(14); - private static final float BORDER_THICKNESS = Utils.scaleX(1); - public static final float PADDING = Utils.scaleX(5); + private static final float BORDER_THICKNESS = Utils.scale(1); + public static final float PADDING = Utils.scale(5); protected static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); protected static final FSkinColor BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2); protected static final FSkinColor GHOST_TEXT_COLOR = FORE_COLOR.alphaColor(0.7f); diff --git a/forge-gui-mobile/src/forge/toolbox/FToggleSwitch.java b/forge-gui-mobile/src/forge/toolbox/FToggleSwitch.java index 3f5a5920dfb..a20425990e7 100644 --- a/forge-gui-mobile/src/forge/toolbox/FToggleSwitch.java +++ b/forge-gui-mobile/src/forge/toolbox/FToggleSwitch.java @@ -15,9 +15,9 @@ public class FToggleSwitch extends FDisplayObject { private static final FSkinColor PRESSED_COLOR = ACTIVE_COLOR.stepColor(-30); private static final FSkinColor INACTIVE_COLOR = FSkinColor.get(Colors.CLR_INACTIVE); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final float BORDER_THICKNESS = Utils.scaleMin(1); - private static final float INSETS = Utils.scaleMin(2); - private static final float PADDING = Utils.scaleMin(3); + private static final float BORDER_THICKNESS = Utils.scale(1); + private static final float INSETS = Utils.scale(2); + private static final float PADDING = Utils.scale(3); private FSkinFont font; private final String offText, onText; diff --git a/forge-gui-mobile/src/forge/util/Utils.java b/forge-gui-mobile/src/forge/util/Utils.java index 0a37cb6fcc0..70f63f2c5f8 100644 --- a/forge-gui-mobile/src/forge/util/Utils.java +++ b/forge-gui-mobile/src/forge/util/Utils.java @@ -9,10 +9,9 @@ public class Utils { public static final float BASE_HEIGHT = 480f; public static final float SCREEN_WIDTH = (float)Gdx.graphics.getWidth(); public static final float SCREEN_HEIGHT = (float)Gdx.graphics.getHeight(); - public static final float WIDTH_RATIO = SCREEN_WIDTH / BASE_WIDTH; - public static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT; - public static final float MIN_RATIO = Math.min(WIDTH_RATIO, HEIGHT_RATIO); - public static final float MAX_RATIO = Math.max(WIDTH_RATIO, HEIGHT_RATIO); + private static final float WIDTH_RATIO = SCREEN_WIDTH / BASE_WIDTH; + private static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT; + private static final float MIN_RATIO = Math.min(WIDTH_RATIO, HEIGHT_RATIO); private static final float AVG_FINGER_SIZE_CM = 1.1f; @@ -21,17 +20,18 @@ public class Utils { public static final int DEV_SCREEN_WIDTH = (int)BASE_WIDTH, DEV_SCREEN_HEIGHT = (int)BASE_HEIGHT; //private static final float ppcX = 169f / AVG_FINGER_SIZE_CM, ppcY = 237f / AVG_FINGER_SIZE_CM; //public static final int DEV_SCREEN_WIDTH = 400, DEV_SCREEN_HEIGHT = 600; - //private static final float scaleX = 1.4f, scaleY = 1.5f; + //private static final float scaleX = 1.9f, scaleY = 1.5f; //private static final float ppcX = Gdx.graphics.getPpcX() * scaleX, ppcY = Gdx.graphics.getPpcY() * scaleY; //public static final int DEV_SCREEN_WIDTH = (int)(BASE_WIDTH * scaleX), DEV_SCREEN_HEIGHT = (int)(BASE_HEIGHT * scaleY); //round to nearest int to reduce floating point display issues //reduce if either would take up too large a percentage of the screen to prevent layouts not working + private static final float MIN_FINGER_SIZE = scale(40); //scaled value of 40 is approximately how tall the Prompt buttons would need to be to fit their text private static final float MIN_FINGERS_WIDE = 5; //ensure screen considered to be at least 5 "fingers" wide private static final float MIN_FINGERS_TALL = MIN_FINGERS_WIDE * BASE_HEIGHT / BASE_WIDTH; //ensure screen tall enough based on fingers wide and base ratio - public static final float AVG_FINGER_WIDTH = Math.round(Math.min(cmToPixelsX(AVG_FINGER_SIZE_CM), SCREEN_WIDTH / MIN_FINGERS_WIDE)); - public static final float AVG_FINGER_HEIGHT = Math.round(Math.min(cmToPixelsY(AVG_FINGER_SIZE_CM), SCREEN_HEIGHT / MIN_FINGERS_TALL)); + public static final float AVG_FINGER_WIDTH = Math.round(Math.min(Math.max(cmToPixelsX(AVG_FINGER_SIZE_CM), MIN_FINGER_SIZE), SCREEN_WIDTH / MIN_FINGERS_WIDE)); + public static final float AVG_FINGER_HEIGHT = Math.round(Math.min(Math.max(cmToPixelsY(AVG_FINGER_SIZE_CM), MIN_FINGER_SIZE), SCREEN_HEIGHT / MIN_FINGERS_TALL)); public static float cmToPixelsX(float cm) { return ppcX * cm; @@ -40,22 +40,10 @@ public class Utils { return ppcY * cm; } - public static float scaleX(float value) { - return Math.round(value * WIDTH_RATIO); - } - - public static float scaleY(float value) { - return Math.round(value * HEIGHT_RATIO); - } - - public static float scaleMin(float value) { + public static float scale(float value) { return Math.round(value * MIN_RATIO); } - public static float scaleMax(float value) { - return Math.round(value * MAX_RATIO); - } - public static long secondsToTimeSpan(float seconds) { return (long)(seconds * 1000000000l); }