Tweak scaling logic so Android app looks better on tablets and so there's only 1 scaling function instead of 4

Version bump to 1.5.28.004
This commit is contained in:
drdev
2014-09-21 03:49:57 +00:00
parent 244293c119
commit 9663105622
51 changed files with 125 additions and 137 deletions

View File

@@ -7,7 +7,7 @@
<packaging.type>jar</packaging.type> <packaging.type>jar</packaging.type>
<build.min.memory>-Xms128m</build.min.memory> <build.min.memory>-Xms128m</build.min.memory>
<build.max.memory>-Xmx2048m</build.max.memory> <build.max.memory>-Xmx2048m</build.max.memory>
<alpha-version>1.5.28.003</alpha-version> <alpha-version>1.5.28.004</alpha-version>
</properties> </properties>
<parent> <parent>

View File

@@ -38,7 +38,7 @@ import forge.util.FileUtil;
import forge.util.Utils; import forge.util.Utils;
public class Forge implements ApplicationListener { 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 final ApplicationListener app = new Forge();
private static Clipboard clipboard; private static Clipboard clipboard;

View File

@@ -39,7 +39,7 @@ public class FSkinFont {
} }
public static FSkinFont get(final int unscaledSize) { 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) { public static FSkinFont _get(final int scaledSize) {
FSkinFont skinFont = fonts.get(scaledSize); FSkinFont skinFont = fonts.get(scaledSize);

View File

@@ -48,12 +48,12 @@ public class CardRenderer {
public static final float NAME_BOX_TINT = 0.2f; public static final float NAME_BOX_TINT = 0.2f;
public static final float TEXT_BOX_TINT = 0.1f; public static final float TEXT_BOX_TINT = 0.1f;
public static final float PT_BOX_TINT = 0.2f; public static final float PT_BOX_TINT = 0.2f;
public static final float MANA_COST_PADDING = Utils.scaleMin(3); public static final float MANA_COST_PADDING = Utils.scale(3);
public static final float SET_BOX_MARGIN = Utils.scaleMin(1); 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)); 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; 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) { private static Color fromDetailColor(DetailColors detailColor) {
return FSkinColor.fromRGB(detailColor.r, detailColor.g, detailColor.b); 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); g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
float padX = TEXT_FONT.getCapHeight() / 2; 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; x += padX;
y += padY; y += padY;
w -= 2 * padX; w -= 2 * padX;
@@ -553,7 +553,7 @@ public class CardRenderer {
if (showCardManaCostOverlay(card)) { if (showCardManaCostOverlay(card)) {
float manaSymbolSize = w / 4; float manaSymbolSize = w / 4;
if (card.isSplitCard() && card.hasAltState()) { 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.getOriginal().getManaCost(), x, y + dy, w, h, manaSymbolSize);
drawManaCost(g, card.getAlternate().getManaCost(), x, y - dy, w, h, manaSymbolSize); drawManaCost(g, card.getAlternate().getManaCost(), x, y - dy, w, h, manaSymbolSize);
} }

View File

@@ -51,7 +51,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
public class AddBasicLandsDialog extends FDialog { public class AddBasicLandsDialog extends FDialog {
private static final float ADD_BTN_SIZE = Utils.AVG_FINGER_HEIGHT * 0.75f; 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<CardPool> callback; private final Callback<CardPool> callback;

View File

@@ -36,7 +36,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class FDeckChooser extends FScreen { public class FDeckChooser extends FScreen {
public static final float PADDING = Utils.scaleMin(5); public static final float PADDING = Utils.scale(5);
private FComboBox<DeckType> cmbDeckTypes; private FComboBox<DeckType> cmbDeckTypes;
private DeckType selectedDeckType; private DeckType selectedDeckType;

View File

@@ -174,7 +174,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
private FEventHandler saveHandler; private FEventHandler saveHandler;
protected final DeckHeader deckHeader = add(new DeckHeader()); 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 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()); private final FLabel btnMoreOptions = deckHeader.add(new FLabel.Builder().text("...").font(FSkinFont.get(20)).align(HAlignment.CENTER).pressedColor(Header.BTN_PRESSED_COLOR).build());

View File

@@ -13,7 +13,7 @@ import forge.util.Aggregates;
import forge.util.Utils; import forge.util.Utils;
public class FVanguardChooser extends FScreen { 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 allHumanAvatars = new CardPool();
private static final CardPool allAiAvatars = new CardPool(); private static final CardPool allAiAvatars = new CardPool();

View File

@@ -20,7 +20,7 @@ import forge.util.Callback;
import forge.util.Utils; import forge.util.Utils;
public class BugReportDialog extends FScreen { //use screen rather than dialog so screen with bug isn't rendered 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; private static boolean isOpen;
public static void show(String title, String text, boolean showExitAppBtn) { 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 BACK_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 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; private final String text;

View File

@@ -11,7 +11,7 @@ import forge.util.Utils;
public abstract class ItemFilter<T extends InventoryItem> { public abstract class ItemFilter<T extends InventoryItem> {
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); public static final FSkinFont DEFAULT_FONT = FSkinFont.get(11);
protected final ItemManager<? super T> itemManager; protected final ItemManager<? super T> itemManager;

View File

@@ -43,16 +43,16 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
public class ImageView<T extends InventoryItem> extends ItemView<T> { public class ImageView<T extends InventoryItem> extends ItemView<T> {
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 float PILE_SPACING_Y = 0.1f;
private static final FSkinFont LABEL_FONT = FSkinFont.get(12); 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_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 FSkinColor GROUP_HEADER_LINE_COLOR = GROUP_HEADER_FORE_COLOR.alphaColor(0.5f);
private static final FSkinFont GROUP_HEADER_FONT = LABEL_FONT; 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_HEIGHT = Utils.scale(19);
private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scaleX(6); private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scale(6);
private static final float GROUP_HEADER_LINE_THICKNESS = Utils.scaleY(1); private static final float GROUP_HEADER_LINE_THICKNESS = Utils.scale(1);
private static final float SEL_BORDER_SIZE = Utils.scaleMax(1); private static final float SEL_BORDER_SIZE = Utils.scale(1);
private static final int MIN_COLUMN_COUNT = 1; private static final int MIN_COLUMN_COUNT = 1;
private static final int MAX_COLUMN_COUNT = 10; private static final int MAX_COLUMN_COUNT = 10;
@@ -102,7 +102,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
@Override @Override
protected void drawContent(Graphics g, float w, float h, final boolean pressed) { 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 offset = 2 * lineThickness;
float squareSize = Math.round(w / 2 - offset); float squareSize = Math.round(w / 2 - offset);
if (squareSize % 2 == 1) { if (squareSize % 2 == 1) {
@@ -420,7 +420,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
float itemAreaWidth = getScroller().getWidth(); float itemAreaWidth = getScroller().getWidth();
float groupWidth = itemAreaWidth - 2 * groupX; 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; float itemWidth = (groupWidth + gap) / columnCount - gap;
if (pileBy != null) { if (pileBy != null) {
//if showing piles, make smaller so part of the next card is visible so it's obvious if scrolling is needed //if showing piles, make smaller so part of the next card is visible so it's obvious if scrolling is needed

View File

@@ -11,7 +11,7 @@ import forge.toolbox.FDisplayObject;
import forge.util.Utils; import forge.util.Utils;
public class FMagnifyView extends FDropDown { 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 FDisplayObject owner;
private String text; private String text;

View File

@@ -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 SEL_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
private static final FSkinColor FORE_COLOR = SEL_FORE_COLOR.alphaColor(0.5f); 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 FSkinColor SEPARATOR_COLOR = SEL_FORE_COLOR.alphaColor(0.3f);
public static final float PADDING = Utils.scaleMin(2); public static final float PADDING = Utils.scale(2);
private static final float SEPARATOR_WIDTH = Utils.scaleX(1); private static final float SEPARATOR_WIDTH = Utils.scale(1);
private final FMenuBar menuBar; private final FMenuBar menuBar;
private final FDropDown dropDown; private final FDropDown dropDown;

View File

@@ -15,7 +15,7 @@ import forge.util.Utils;
public class FTooltip extends FDropDown { public class FTooltip extends FDropDown {
private static final FSkinFont FONT = FSkinFont.get(12); private static final FSkinFont FONT = FSkinFont.get(12);
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 FDisplayObject owner;
private float x, y; private float x, y;

View File

@@ -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 BTN_PRESSED_COLOR = TEXTURE_OVERLAY_COLOR.alphaColor(1f);
public static final FSkinColor LINE_COLOR = BTN_PRESSED_COLOR.stepColor(-40); 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 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(); public abstract float getPreferredHeight();
} }
@@ -158,7 +158,7 @@ public abstract class FScreen extends FContainer {
} }
protected static class BackIcon implements FImage { 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 static final FSkinColor COLOR = FSkinColor.get(Colors.CLR_TEXT);
private final float width, height; private final float width, height;

View File

@@ -9,13 +9,14 @@ import forge.assets.FSkinColor;
import forge.assets.FSkinColor.Colors; import forge.assets.FSkinColor.Colors;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
import forge.assets.FSkinImage; import forge.assets.FSkinImage;
import forge.screens.home.HomeScreen;
import forge.toolbox.FDialog; import forge.toolbox.FDialog;
import forge.toolbox.FOverlay; import forge.toolbox.FOverlay;
import forge.util.ThreadUtil; import forge.util.ThreadUtil;
import forge.util.Utils; import forge.util.Utils;
public class LoadingOverlay extends FOverlay { 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 FSkinFont FONT = FSkinFont.get(22);
private static final FSkinColor BACK_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.75f); 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); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
@@ -57,14 +58,14 @@ public class LoadingOverlay extends FOverlay {
float x = insets; float x = insets;
float w = getWidth() - 2 * insets; float w = getWidth() - 2 * insets;
float padding = w * HomeScreen.INSETS_FACTOR; float padding = w * INSETS_FACTOR;
float logoSize = w * HomeScreen.LOGO_SIZE_FACTOR; float logoSize = w * LOGO_SIZE_FACTOR;
float fontHeight = FONT.getCapHeight(); float fontHeight = FONT.getCapHeight();
float panelHeight = logoSize + fontHeight + 4 * padding; float panelHeight = logoSize + fontHeight + 4 * padding;
float y = (getHeight() - panelHeight) / 2; float y = (getHeight() - panelHeight) / 2;
g.fillRect(BACK_COLOR, x, y, w, panelHeight); 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; y += padding;
g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize); g.drawImage(FSkinImage.LOGO, (getWidth() - logoSize) / 2f, y, logoSize, logoSize);
y += logoSize + padding; y += logoSize + padding;

View File

@@ -35,7 +35,7 @@ public class AvatarSelector extends FScreen {
Forge.openScreen(selector); 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 static final int COLUMNS = 4;
private final int currentIndex; private final int currentIndex;

View File

@@ -53,7 +53,7 @@ import forge.util.Utils;
public class ConstructedScreen extends LaunchScreen { public class ConstructedScreen extends LaunchScreen {
private static final ForgePreferences prefs = FModel.getPreferences(); 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 int MAX_PLAYERS = 2; //8; //TODO: Support multiplayer
private static final FSkinFont VARIANTS_FONT = FSkinFont.get(12); private static final FSkinFont VARIANTS_FONT = FSkinFont.get(12);
private static final FSkinFont LABEL_FONT = FSkinFont.get(14); private static final FSkinFont LABEL_FONT = FSkinFont.get(14);

View File

@@ -5,7 +5,6 @@ import java.util.ArrayList;
import forge.screens.FScreen; import forge.screens.FScreen;
import forge.screens.LoadingOverlay; import forge.screens.LoadingOverlay;
import forge.Forge; import forge.Forge;
import forge.Graphics;
import forge.assets.FSkinImage; import forge.assets.FSkinImage;
import forge.screens.constructed.ConstructedScreen; import forge.screens.constructed.ConstructedScreen;
import forge.screens.draft.DraftScreen; import forge.screens.draft.DraftScreen;
@@ -17,11 +16,13 @@ import forge.screens.settings.SettingsScreen;
import forge.toolbox.FButton; import forge.toolbox.FButton;
import forge.toolbox.FEvent; import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler; import forge.toolbox.FEvent.FEventHandler;
import forge.toolbox.FLabel;
import forge.util.Utils;
public class HomeScreen extends FScreen { public class HomeScreen extends FScreen {
public static final float LOGO_SIZE_FACTOR = 0.7f; private static final float PADDING = Utils.scale(5);
public static final float INSETS_FACTOR = 0.025f;
private static final float GAP_Y_FACTOR = 0.01f; private final FLabel lblLogo = add(new FLabel.Builder().icon(FSkinImage.LOGO).iconInBackground().iconScaleFactor(1).build());
private final ArrayList<FButton> buttons = new ArrayList<FButton>(); private final ArrayList<FButton> buttons = new ArrayList<FButton>();
public HomeScreen() { public HomeScreen() {
@@ -76,26 +77,24 @@ public class HomeScreen extends FScreen {
@Override @Override
protected void doLayout(float startY, float width, float height) { protected void doLayout(float startY, float width, float height) {
float x = width * INSETS_FACTOR; float buttonWidth = width - 2 * PADDING;
float y = width * LOGO_SIZE_FACTOR + 2 * x; //start below background logo float buttonHeight = buttons.get(0).getFont().getCapHeight() * 3.5f;
float dy = height * GAP_Y_FACTOR; float x = PADDING;
float buttonWidth = width - 2 * x; float y = height;
float buttonHeight = (height - y - x) / buttons.size() - dy; float dy = buttonHeight + PADDING;
dy += buttonHeight;
for (FButton button : buttons) { for (int i = buttons.size() - 1; i >= 0; i--) {
button.setBounds(x, y, buttonWidth, buttonHeight); y -= dy;
y += dy; buttons.get(i).setBounds(x, y, buttonWidth, buttonHeight);
} }
}
@Override float logoSize = y - 2 * PADDING;
protected void drawBackground(Graphics g) { y = PADDING;
super.drawBackground(g); if (logoSize > buttonWidth) {
y += (logoSize - buttonWidth) / 2;
float size = getWidth() * LOGO_SIZE_FACTOR; logoSize = buttonWidth;
float x = (getWidth() - size) / 2f; }
float y = getWidth() * INSETS_FACTOR; x = (width - logoSize) / 2;
g.drawImage(FSkinImage.LOGO, x, y, size, size); lblLogo.setBounds(x, y, logoSize, logoSize);
} }
} }

View File

@@ -29,8 +29,8 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
public class TargetingOverlay { public class TargetingOverlay {
private static final float BORDER_THICKNESS = Utils.scaleMin(1); private static final float BORDER_THICKNESS = Utils.scale(1);
private static final float ARROW_THICKNESS = Utils.scaleMax(5); private static final float ARROW_THICKNESS = Utils.scale(5);
private static final float ARROW_SIZE = 3 * ARROW_THICKNESS; private static final float ARROW_SIZE = 3 * ARROW_THICKNESS;
private static FSkinColor friendColor, foeColor; private static FSkinColor friendColor, foeColor;

View File

@@ -50,7 +50,7 @@ import java.util.Map;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
public class VAssignDamage extends FDialog { 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 static final float ADD_BTN_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
private final Callback<Map<CardView, Integer>> callback; private final Callback<Map<CardView, Integer>> callback;

View File

@@ -19,7 +19,7 @@ import forge.util.Utils;
import forge.view.IGameView; import forge.view.IGameView;
public class VLog extends FDropDown { 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 FSkinFont FONT = FSkinFont.get(11);
private static final FSkinColor ALT_ROW_COLOR = FSkinColor.get(Colors.CLR_ZEBRA); private static final FSkinColor ALT_ROW_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
private static final FSkinColor ROW_COLOR = ALT_ROW_COLOR.darker(); private static final FSkinColor ROW_COLOR = ALT_ROW_COLOR.darker();

View File

@@ -18,8 +18,8 @@ import forge.util.Utils;
public class VPhaseIndicator extends FContainer { public class VPhaseIndicator extends FContainer {
private static final FSkinFont BASE_FONT = FSkinFont.get(11); private static final FSkinFont BASE_FONT = FSkinFont.get(11);
private static final float PADDING_X = Utils.scaleX(1); private static final float PADDING_X = Utils.scale(1);
private static final float PADDING_Y = Utils.scaleY(2); private static final float PADDING_Y = Utils.scale(2);
private final Map<PhaseType, PhaseLabel> phaseLabels = new HashMap<PhaseType, PhaseLabel>(); private final Map<PhaseType, PhaseLabel> phaseLabels = new HashMap<PhaseType, PhaseLabel>();
private FSkinFont font; private FSkinFont font;

View File

@@ -29,8 +29,8 @@ public class VPlayerPanel extends FContainer {
private static final FSkinFont INFO_FONT = FSkinFont.get(12); 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 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 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_X = Utils.scale(2);
private static final float INFO_TAB_PADDING_Y = Utils.scaleY(2); private static final float INFO_TAB_PADDING_Y = Utils.scale(2);
private final PlayerView player; private final PlayerView player;
private final VPhaseIndicator phaseIndicator; private final VPhaseIndicator phaseIndicator;
@@ -304,7 +304,7 @@ public class VPlayerPanel extends FContainer {
} }
else { else {
float halfHeight = getHeight() / 2; float halfHeight = getHeight() / 2;
float textStart = halfHeight + Utils.scaleX(1); float textStart = halfHeight + Utils.scale(1);
float textWidth = getWidth() - textStart; float textWidth = getWidth() - textStart;
g.drawImage(FSkinImage.QUEST_LIFE, 0, 0, halfHeight, halfHeight); 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); g.drawText(lifeStr, INFO_FONT, INFO_FORE_COLOR, textStart, 0, textWidth, halfHeight, false, HAlignment.CENTER, true);

View File

@@ -44,7 +44,7 @@ public class VPlayers extends FDropDown {
private static class PlayerInfoPanel extends FContainer { private static class PlayerInfoPanel extends FContainer {
private static final FSkinFont FONT = FSkinFont.get(12); 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 static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 1.8f;
private final PlayerView player; private final PlayerView player;

View File

@@ -21,11 +21,11 @@ import forge.util.Utils;
public class VPrompt extends FContainer { public class VPrompt extends FContainer {
public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT; public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT;
public static final float BTN_WIDTH = HEIGHT * 1.5f; 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 BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2);
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 FButton btnOk, btnCancel;
private final MessageLabel lblMessage; private final MessageLabel lblMessage;

View File

@@ -40,9 +40,9 @@ import forge.view.StackItemView;
public class VStack extends FDropDown { public class VStack extends FDropDown {
public static final float CARD_WIDTH = Utils.AVG_FINGER_WIDTH; 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 CARD_HEIGHT = Math.round(CARD_WIDTH * FCardPanel.ASPECT_RATIO);
public static final float BORDER_THICKNESS = Utils.scaleMin(2); public static final float BORDER_THICKNESS = Utils.scale(2);
public static final float PADDING = Utils.scaleMin(3); public static final float PADDING = Utils.scale(3);
public static final float MARGINS = Utils.scaleMin(4); public static final float MARGINS = Utils.scale(4);
private static final FSkinFont FONT = FSkinFont.get(11); private static final FSkinFont FONT = FSkinFont.get(11);
private static final float ALPHA_COMPOSITE = 0.5f; private static final float ALPHA_COMPOSITE = 0.5f;
private static final TextRenderer textRenderer = new TextRenderer(true); private static final TextRenderer textRenderer = new TextRenderer(true);

View File

@@ -189,7 +189,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
} }
private static class OutcomesPanel extends FContainer { 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 @Override
protected void doLayout(float width, float height) { protected void doLayout(float width, float height) {

View File

@@ -271,8 +271,8 @@ public class LoadQuestScreen extends FScreen {
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;
y += h; y += h;
h = totalHeight - h + w * SettingsScreen.INSETS_FACTOR; h = totalHeight - h + w * SettingsScreen.INSETS_FACTOR;
float iconSize = h + Utils.scaleMin(1); float iconSize = h + Utils.scale(1);
float iconOffset = SettingsScreen.SETTING_PADDING - Utils.scaleX(2); float iconOffset = SettingsScreen.SETTING_PADDING - Utils.scale(2);
String cards = String.valueOf(value.getAssets().getCardPool().countAll()); String cards = String.valueOf(value.getAssets().getCardPool().countAll());
String credits = String.valueOf(value.getAssets().getCredits()); String credits = String.valueOf(value.getAssets().getCredits());

View File

@@ -49,7 +49,7 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
} }
private static class BazaarPage extends TabPage<QuestBazaarScreen> { private static class BazaarPage extends TabPage<QuestBazaarScreen> {
private static final float PADDING = Utils.scaleMax(5); private static final float PADDING = Utils.scale(5);
private final QuestStallDefinition stallDef; private final QuestStallDefinition stallDef;
private final FLabel lblStallName = add(new FLabel.Builder().text("").align(HAlignment.CENTER).build()); private final FLabel lblStallName = add(new FLabel.Builder().text("").align(HAlignment.CENTER).build());

View File

@@ -30,7 +30,7 @@ class QuestEventPanel extends FDisplayObject {
private static final FSkinFont DESC_FONT = FSkinFont.get(12); private static final FSkinFont DESC_FONT = FSkinFont.get(12);
private static final FSkinColor TITLE_COLOR = FList.FORE_COLOR; private static final FSkinColor TITLE_COLOR = FList.FORE_COLOR;
private static final FSkinColor DESC_COLOR = SettingsScreen.DESC_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 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 Color GRADIENT_RIGHT_COLOR = new Color(1, 1, 0, 0);
private static final float RADIO_BUTTON_RADIUS = Utils.AVG_FINGER_WIDTH / 4; private static final float RADIO_BUTTON_RADIUS = Utils.AVG_FINGER_WIDTH / 4;
@@ -108,7 +108,7 @@ class QuestEventPanel extends FDisplayObject {
//draw radio button //draw radio button
x = getWidth() - PADDING - RADIO_BUTTON_RADIUS; x = getWidth() - PADDING - RADIO_BUTTON_RADIUS;
y = h / 2; 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()) { if (isSelected()) {
g.fillCircle(TITLE_COLOR, x, y, RADIO_BUTTON_RADIUS / 2); g.fillCircle(TITLE_COLOR, x, y, RADIO_BUTTON_RADIUS / 2);
} }

View File

@@ -19,7 +19,7 @@ import forge.toolbox.FTextField;
import forge.util.Utils; import forge.util.Utils;
public class QuestPrefsScreen extends FScreen { public class QuestPrefsScreen extends FScreen {
private static final float PADDING = Utils.scaleMin(5); private static final float PADDING = Utils.scale(5);
private enum PrefsGroup { private enum PrefsGroup {
REWARDS, REWARDS,

View File

@@ -153,7 +153,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
@Override @Override
protected void doLayout(float width, float height) { 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; float halfWidth = width / 2;
lblCredits.setBounds(0, y, halfWidth, lblCredits.getAutoSizeBounds().height); lblCredits.setBounds(0, y, halfWidth, lblCredits.getAutoSizeBounds().height);
getSecondLabel().setBounds(halfWidth, y, halfWidth, lblCredits.getHeight()); getSecondLabel().setBounds(halfWidth, y, halfWidth, lblCredits.getHeight());

View File

@@ -98,7 +98,7 @@ public class QuestStatsScreen extends FScreen {
public QuestStatsScreen() { public QuestStatsScreen() {
super("Quest Statistics", QuestMenu.getMenu()); super("Quest Statistics", QuestMenu.getMenu());
lblZep.setHeight(Utils.scaleY(60)); lblZep.setHeight(Utils.scale(60));
cbxPet.setDropDownChangeHandler(new FEventHandler() { cbxPet.setDropDownChangeHandler(new FEventHandler() {
@Override @Override

View File

@@ -25,8 +25,8 @@ import forge.util.Utils;
public class AchievementsPage extends TabPage<SettingsScreen> { public class AchievementsPage extends TabPage<SettingsScreen> {
private static final float TROPHY_PADDING = 45; private static final float TROPHY_PADDING = 45;
private static final float PADDING = Utils.scaleMin(5); private static final float PADDING = Utils.scale(5);
private static final float SELECTED_BORDER_THICKNESS = Utils.scaleMin(1); private static final float SELECTED_BORDER_THICKNESS = Utils.scale(1);
private static final int MIN_SHELVES = 4; private static final int MIN_SHELVES = 4;
private static final int TROPHIES_PER_SHELVE = 4; private static final int TROPHIES_PER_SHELVE = 4;
private static final FSkinFont NAME_FONT = FSkinFont.get(14); private static final FSkinFont NAME_FONT = FSkinFont.get(14);

View File

@@ -307,7 +307,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
float radius = h / 3; float radius = h / 3;
x += w - radius; x += w - radius;
y += h / 2; 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)) { if (value.equals(currentValue)) {
g.fillCircle(foreColor, x, y, radius / 2); g.fillCircle(foreColor, x, y, radius / 2);
} }

View File

@@ -11,8 +11,8 @@ public class SettingsScreen extends TabPageScreen<SettingsScreen> {
public static final float INSETS_FACTOR = 0.025f; public static final float INSETS_FACTOR = 0.025f;
public static final FSkinFont DESC_FONT = FSkinFont.get(11); 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 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_HEIGHT = Utils.AVG_FINGER_HEIGHT + Utils.scale(12);
public static final float SETTING_PADDING = Utils.scaleY(5); public static final float SETTING_PADDING = Utils.scale(5);
private static SettingsScreen settingsScreen; //keep settings screen around so scroll positions maintained private static SettingsScreen settingsScreen; //keep settings screen around so scroll positions maintained

View File

@@ -20,7 +20,7 @@ import forge.util.Utils;
public class FButton extends FDisplayObject implements IButton { public class FButton extends FDisplayObject implements IButton {
private static final FSkinColor DEFAULT_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 FSkinImage imgL, imgM, imgR;
private String text; private String text;

View File

@@ -8,7 +8,7 @@ import forge.view.CardView;
public class FCardPanel extends FDisplayObject { public class FCardPanel extends FDisplayObject {
public static final float TAPPED_ANGLE = -90; public static final float TAPPED_ANGLE = -90;
public static final float ASPECT_RATIO = 3.5f / 2.5f; 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_X = 0.15f;
public static final float TARGET_ORIGIN_FACTOR_Y = 0.5f; public static final float TARGET_ORIGIN_FACTOR_Y = 0.5f;

View File

@@ -12,7 +12,7 @@ import forge.util.Utils;
public class FCheckBox extends FLabel implements ICheckBox { public class FCheckBox extends FLabel implements ICheckBox {
private static final FSkinColor CHECK_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 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() { public FCheckBox() {
this("", false); this("", false);
@@ -56,15 +56,15 @@ public class FCheckBox extends FLabel implements ICheckBox {
drawCheckBox(g, BOX_COLOR, CHECK_COLOR, isChecked, x, y, w, h); 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) { 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) { if (isChecked) {
//draw check mark //draw check mark
float padX = Utils.scaleX(3); float padX = Utils.scale(3);
float thickness = Utils.scaleMin(2); float thickness = Utils.scale(2);
x += padX; x += padX;
y += Utils.scaleY(1); y += Utils.scale(1);
w -= 2 * padX; 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, y + h / 2, x + w / 2, y + h);
g.drawLine(thickness, checkColor, x + w / 2, y + h, x + w, y); g.drawLine(thickness, checkColor, x + w / 2, y + h, x + w, y);
} }

View File

@@ -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 TITLE_BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2);
private static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS); 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 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; private static int openDialogCount = 0;
public static boolean isDialogOpen() { public static boolean isDialogOpen() {

View File

@@ -22,7 +22,7 @@ import forge.util.FileUtil;
import forge.util.Utils; import forge.util.Utils;
public class FFileChooser extends FDialog { 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 { public enum ChoiceType {
OpenFile, OpenFile,

View File

@@ -23,7 +23,7 @@ public class FLabel extends FDisplayObject implements IButton {
private FSkinFont bldFont = FSkinFont.get(14); private FSkinFont bldFont = FSkinFont.get(14);
private float bldAlphaComposite = 0.7f; private float bldAlphaComposite = 0.7f;
private HAlignment bldAlignment = HAlignment.LEFT; 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 bldSelectable = false;
private boolean bldSelected = 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 d10 = clrMain.stepColor(-10);
private static final FSkinColor l10 = clrMain.stepColor(10); private static final FSkinColor l10 = clrMain.stepColor(10);
private static final FSkinColor l20 = clrMain.stepColor(20); 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 float iconScaleFactor;
private FSkinFont font; private FSkinFont font;
@@ -293,8 +293,8 @@ public class FLabel extends FDisplayObject implements IButton {
w -= 2 * x; w -= 2 * x;
h -= 2 * y; h -= 2 * y;
if (pressed) { //while pressed, translate graphics so icon and text appear shifted down and to the right if (pressed) { //while pressed, translate graphics so icon and text appear shifted down and to the right
x += Utils.scaleX(1); x += Utils.scale(1);
y += Utils.scaleY(1); y += Utils.scale(1);
} }
if (icon != null) { if (icon != null) {

View File

@@ -17,11 +17,11 @@ import forge.screens.FScreen;
import forge.util.Utils; import forge.util.Utils;
public class FList<T> extends FScrollPane implements Iterable<T> { public class FList<T> extends FScrollPane implements Iterable<T> {
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 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 PRESSED_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.9f);
public static final FSkinColor LINE_COLOR = FORE_COLOR.alphaColor(0.5f); 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<T> items = new ArrayList<T>(); private final List<T> items = new ArrayList<T>();
private FSkinFont font; private FSkinFont font;

View File

@@ -23,11 +23,11 @@ public class FOptionPane extends FDialog {
public static final FSkinImage WARNING_ICON = FSkinImage.WARNING; public static final FSkinImage WARNING_ICON = FSkinImage.WARNING;
public static final FSkinImage ERROR_ICON = FSkinImage.ERROR; public static final FSkinImage ERROR_ICON = FSkinImage.ERROR;
public static final float PADDING = Utils.scaleMin(10); public static final float PADDING = Utils.scale(10);
public static final float GAP_BETWEEN_BUTTONS = Utils.scaleX(3); public static final float GAP_BETWEEN_BUTTONS = Utils.scale(3);
public static final float GAP_BELOW_BUTTONS = PADDING * 0.5f; 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 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() { public static float getMaxDisplayObjHeight() {
return Forge.getCurrentScreen().getHeight() - 2 * VPrompt.HEIGHT - FDialog.TITLE_HEIGHT - return Forge.getCurrentScreen().getHeight() - 2 * VPrompt.HEIGHT - FDialog.TITLE_HEIGHT -
@@ -255,7 +255,7 @@ public class FOptionPane extends FDialog {
float promptHeight = 0; float promptHeight = 0;
if (lblIcon != null) { 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(); promptHeight = lblIcon.getIcon().getHeight() * labelWidth / lblIcon.getIcon().getWidth();
if (promptHeight > maxPromptHeight) { if (promptHeight > maxPromptHeight) {
promptHeight = maxPromptHeight; promptHeight = maxPromptHeight;
@@ -265,7 +265,7 @@ public class FOptionPane extends FDialog {
y += promptHeight + PADDING; y += promptHeight + PADDING;
} }
else { else {
lblIcon.setBounds(x - Utils.scaleX(3), y, labelWidth, promptHeight); lblIcon.setBounds(x - Utils.scale(3), y, labelWidth, promptHeight);
x += labelWidth; x += labelWidth;
} }
} }

View File

@@ -175,6 +175,6 @@ public class FProgressBar extends FDisplayObject implements IProgressBar {
} }
//draw border //draw border
g.drawRect(Utils.scaleMin(1), Color.BLACK, 0, 0, w, h); g.drawRect(Utils.scale(1), Color.BLACK, 0, 0, w, h);
} }
} }

View File

@@ -14,7 +14,7 @@ import forge.util.Utils;
public class FRadioButton extends FLabel { public class FRadioButton extends FLabel {
private static final FSkinColor INNER_CIRCLE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 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; private RadioButtonGroup group;
@@ -81,7 +81,7 @@ public class FRadioButton extends FLabel {
float radius = h / 3; float radius = h / 3;
x += w - radius; x += w - radius;
y += h / 2; 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()) { if (isSelected()) {
g.fillCircle(INNER_CIRCLE_COLOR, x, y, radius / 2); g.fillCircle(INNER_CIRCLE_COLOR, x, y, radius / 2);
} }

View File

@@ -12,8 +12,8 @@ import forge.util.Utils;
public abstract class FScrollPane extends FContainer { public abstract class FScrollPane extends FContainer {
private static final float FLING_DECEL = 750f; private static final float FLING_DECEL = 750f;
/*private static final FSkinColor INDICATOR_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.7f); /*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_SIZE = Utils.scale(5);
private static final float INDICATOR_MARGIN = Utils.scaleMax(3);*/ private static final float INDICATOR_MARGIN = Utils.scale(3);*/
private float scrollLeft, scrollTop; private float scrollLeft, scrollTop;
private ScrollBounds scrollBounds; private ScrollBounds scrollBounds;

View File

@@ -17,8 +17,8 @@ import forge.util.Utils;
public class FTextField extends FDisplayObject implements ITextField { public class FTextField extends FDisplayObject implements ITextField {
private static final FSkinFont DEFAULT_FONT = FSkinFont.get(14); private static final FSkinFont DEFAULT_FONT = FSkinFont.get(14);
private static final float BORDER_THICKNESS = Utils.scaleX(1); private static final float BORDER_THICKNESS = Utils.scale(1);
public static final float PADDING = Utils.scaleX(5); public static final float PADDING = Utils.scale(5);
protected static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); 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 BACK_COLOR = FSkinColor.get(Colors.CLR_THEME2);
protected static final FSkinColor GHOST_TEXT_COLOR = FORE_COLOR.alphaColor(0.7f); protected static final FSkinColor GHOST_TEXT_COLOR = FORE_COLOR.alphaColor(0.7f);

View File

@@ -15,9 +15,9 @@ public class FToggleSwitch extends FDisplayObject {
private static final FSkinColor PRESSED_COLOR = ACTIVE_COLOR.stepColor(-30); 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 INACTIVE_COLOR = FSkinColor.get(Colors.CLR_INACTIVE);
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
private static final float BORDER_THICKNESS = Utils.scaleMin(1); private static final float BORDER_THICKNESS = Utils.scale(1);
private static final float INSETS = Utils.scaleMin(2); private static final float INSETS = Utils.scale(2);
private static final float PADDING = Utils.scaleMin(3); private static final float PADDING = Utils.scale(3);
private FSkinFont font; private FSkinFont font;
private final String offText, onText; private final String offText, onText;

View File

@@ -9,10 +9,9 @@ public class Utils {
public static final float BASE_HEIGHT = 480f; public static final float BASE_HEIGHT = 480f;
public static final float SCREEN_WIDTH = (float)Gdx.graphics.getWidth(); public static final float SCREEN_WIDTH = (float)Gdx.graphics.getWidth();
public static final float SCREEN_HEIGHT = (float)Gdx.graphics.getHeight(); public static final float SCREEN_HEIGHT = (float)Gdx.graphics.getHeight();
public static final float WIDTH_RATIO = SCREEN_WIDTH / BASE_WIDTH; private static final float WIDTH_RATIO = SCREEN_WIDTH / BASE_WIDTH;
public static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT; private static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT;
public static final float MIN_RATIO = Math.min(WIDTH_RATIO, HEIGHT_RATIO); private 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 AVG_FINGER_SIZE_CM = 1.1f; 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; 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; //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; //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; //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); //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 //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 //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_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 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_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(cmToPixelsY(AVG_FINGER_SIZE_CM), SCREEN_HEIGHT / MIN_FINGERS_TALL)); 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) { public static float cmToPixelsX(float cm) {
return ppcX * cm; return ppcX * cm;
@@ -40,22 +40,10 @@ public class Utils {
return ppcY * cm; return ppcY * cm;
} }
public static float scaleX(float value) { public static float scale(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) {
return Math.round(value * MIN_RATIO); return Math.round(value * MIN_RATIO);
} }
public static float scaleMax(float value) {
return Math.round(value * MAX_RATIO);
}
public static long secondsToTimeSpan(float seconds) { public static long secondsToTimeSpan(float seconds) {
return (long)(seconds * 1000000000l); return (long)(seconds * 1000000000l);
} }