Start working on Landscape mode

This commit is contained in:
drdev
2015-05-05 23:45:24 +00:00
parent 49cc5d218a
commit 4a09b1ef92
6 changed files with 21 additions and 10 deletions

View File

@@ -217,6 +217,14 @@ public class Forge implements ApplicationListener {
}); });
} }
public static int getScreenWidth() {
return screenWidth;
}
public static int getScreenHeight() {
return screenHeight;
}
public static FScreen getCurrentScreen() { public static FScreen getCurrentScreen() {
return currentScreen; return currentScreen;
} }

View File

@@ -115,7 +115,7 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s
private TemplateView(String text0) { private TemplateView(String text0) {
text = text0; text = text0;
setHeight(Forge.getCurrentScreen().getHeight() / 3); setHeight(Forge.getScreenHeight() / 3);
} }
@Override @Override

View File

@@ -175,7 +175,7 @@ public class VStack extends FDropDown {
} }
FMenuTab menuTab = getMenuTab(); FMenuTab menuTab = getMenuTab();
float screenHeight = Forge.getCurrentScreen().getHeight(); float screenHeight = Forge.getScreenHeight();
float width = (screenHeight - 2 * VPrompt.HEIGHT - 2 * VAvatar.HEIGHT) * 4f / 6f; float width = (screenHeight - 2 * VPrompt.HEIGHT - 2 * VAvatar.HEIGHT) * 4f / 6f;
float maxVisibleHeight = menuTab.screenPos.x; float maxVisibleHeight = menuTab.screenPos.x;
paneSize = updateAndGetPaneSize(width + MatchController.getView().getTopPlayerPanel().getTabs().iterator().next().getRight(), maxVisibleHeight); paneSize = updateAndGetPaneSize(width + MatchController.getView().getTopPlayerPanel().getTabs().iterator().next().getRight(), maxVisibleHeight);

View File

@@ -3,6 +3,7 @@ package forge.toolbox;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.animation.ForgeAnimation; import forge.animation.ForgeAnimation;
import forge.assets.FSkinColor; import forge.assets.FSkinColor;
@@ -27,7 +28,6 @@ public abstract class FDialog extends FOverlay {
private static final FSkinColor SWIPE_BAR_COLOR = FScreen.Header.BACK_COLOR; private static final FSkinColor SWIPE_BAR_COLOR = FScreen.Header.BACK_COLOR;
private static final FSkinColor SWIPE_BAR_DOT_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.75f); private static final FSkinColor SWIPE_BAR_DOT_COLOR = FSkinColor.get(Colors.CLR_TEXT).alphaColor(0.75f);
private static final float SWIPE_BAR_HEIGHT = Utils.scale(12); private static final float SWIPE_BAR_HEIGHT = Utils.scale(12);
private static final float BASE_REVEAL_VELOCITY = 3 * Utils.SCREEN_HEIGHT;
private static int openDialogCount = 0; private static int openDialogCount = 0;
@@ -83,7 +83,7 @@ public abstract class FDialog extends FOverlay {
updateDisplayTop(); updateDisplayTop();
if (firstReveal) { //start reveal animation after dialog first laid out if (firstReveal) { //start reveal animation after dialog first laid out
updateRevealAnimation(BASE_REVEAL_VELOCITY); updateRevealAnimation(3 * Forge.getScreenHeight());
} }
} }

View File

@@ -32,7 +32,7 @@ public class FOptionPane extends FDialog {
public static final float PADDING = Utils.scale(10); public static final float PADDING = Utils.scale(10);
public static float getMaxDisplayObjHeight() { public static float getMaxDisplayObjHeight() {
return Forge.getCurrentScreen().getHeight() - VPrompt.HEIGHT - 2 * FDialog.MSG_HEIGHT; return Forge.getScreenHeight() - VPrompt.HEIGHT - 2 * FDialog.MSG_HEIGHT;
} }
public static void showMessageDialog(final String message) { public static void showMessageDialog(final String message) {
@@ -127,7 +127,7 @@ public class FOptionPane extends FDialog {
CardRenderer.drawCard(g, card, x, y, w, h, CardStackPosition.Top); CardRenderer.drawCard(g, card, x, y, w, h, CardStackPosition.Top);
} }
}; };
cardDisplay.setHeight(Utils.SCREEN_HEIGHT / 2); cardDisplay.setHeight(Forge.getScreenHeight() / 2);
} }
else { else {
cardDisplay = null; cardDisplay = null;
@@ -195,7 +195,7 @@ public class FOptionPane extends FDialog {
}) { }) {
@Override @Override
protected float getBottomMargin() { protected float getBottomMargin() {
return Utils.SCREEN_HEIGHT * 0.4f; //account for keyboard return Forge.getScreenHeight() * 0.4f; //account for keyboard
} }
@Override @Override

View File

@@ -5,17 +5,20 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
public class Utils { public class Utils {
public static final boolean DEV_SCREEN_LANDSCAPE = false;
public static final float BASE_WIDTH = 320f; public static final float BASE_WIDTH = 320f;
public static final float BASE_HEIGHT = 480f; public static final float BASE_HEIGHT = 480f;
public static final float SCREEN_WIDTH = (float)Gdx.graphics.getWidth(); private static final float SCREEN_WIDTH = (float)Gdx.graphics.getWidth();
public static final float SCREEN_HEIGHT = (float)Gdx.graphics.getHeight(); private static final float SCREEN_HEIGHT = (float)Gdx.graphics.getHeight();
private static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT; private static final float HEIGHT_RATIO = SCREEN_HEIGHT / BASE_HEIGHT;
private static final float AVG_FINGER_SIZE_CM = 1.1f; private static final float AVG_FINGER_SIZE_CM = 1.1f;
//Swap commented out line below to specify average finger size and dev screen size //Swap commented out line below to specify average finger size and dev screen size
private static final float ppcX = Gdx.graphics.getPpcX(), ppcY = Gdx.graphics.getPpcY(); private static final float ppcX = Gdx.graphics.getPpcX(), ppcY = Gdx.graphics.getPpcY();
public static final int DEV_SCREEN_WIDTH = (int)BASE_WIDTH, DEV_SCREEN_HEIGHT = (int)BASE_HEIGHT; public static final int DEV_SCREEN_WIDTH = DEV_SCREEN_LANDSCAPE ? (int)(BASE_HEIGHT * 16 / 9) : (int)BASE_WIDTH;
public static final int 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.41f, scaleY = 1.25f; //private static final float scaleX = 1.41f, scaleY = 1.25f;