mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
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:
@@ -7,7 +7,7 @@
|
||||
<packaging.type>jar</packaging.type>
|
||||
<build.min.memory>-Xms128m</build.min.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>
|
||||
|
||||
<parent>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<CardPool> callback;
|
||||
|
||||
|
||||
@@ -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<DeckType> cmbDeckTypes;
|
||||
private DeckType selectedDeckType;
|
||||
|
||||
@@ -174,7 +174,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
||||
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());
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import forge.util.Utils;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
protected final ItemManager<? super T> itemManager;
|
||||
|
||||
@@ -43,16 +43,16 @@ import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
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 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<T extends InventoryItem> extends ItemView<T> {
|
||||
|
||||
@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<T extends InventoryItem> extends ItemView<T> {
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<FButton> buttons = new ArrayList<FButton>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<Map<CardView, Integer>> callback;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<PhaseType, PhaseLabel> phaseLabels = new HashMap<PhaseType, PhaseLabel>();
|
||||
private FSkinFont font;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class QuestBazaarScreen extends TabPageScreen<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 FLabel lblStallName = add(new FLabel.Builder().text("").align(HAlignment.CENTER).build());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -153,7 +153,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
||||
|
||||
@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());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,8 +25,8 @@ import forge.util.Utils;
|
||||
|
||||
public class AchievementsPage extends TabPage<SettingsScreen> {
|
||||
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);
|
||||
|
||||
@@ -307,7 +307,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ public class SettingsScreen extends TabPageScreen<SettingsScreen> {
|
||||
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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -17,11 +17,11 @@ import forge.screens.FScreen;
|
||||
import forge.util.Utils;
|
||||
|
||||
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 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<T> items = new ArrayList<T>();
|
||||
private FSkinFont font;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user