summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java9
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/MenuScreen.java6
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/UiScreen.java6
3 files changed, 16 insertions, 5 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java
index e564790..df0723c 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java
@@ -18,7 +18,6 @@ import ch.asynk.gdx.boardgame.ui.Root;
public abstract class AbstractScreen implements Screen
{
- protected final float WORLD_RATIO = 0.5f;
private static final float INPUT_DELAY = 0.1f; // filter out touches after gesture
private static final float ZOOM_SCROLL_FACTOR = .1f;
private static final float ZOOM_GESTURE_FACTOR = .01f;
@@ -68,9 +67,9 @@ public abstract class AbstractScreen implements Screen
batch.end();
}
- @Override public void resize(int width, int height)
+ public void resize(int width, int height, float ratio)
{
- GdxBoardTest.debug(dom, String.format("resize (%d,%d)",width, height));
+ GdxBoardTest.debug(dom, String.format("resize (%d,%d)", width, height));
if (width >= height) {
camera.viewportWidth = bg.getWidth();
camera.viewportHeight = bg.getHeight() / (float)width * (float)height;
@@ -78,8 +77,8 @@ public abstract class AbstractScreen implements Screen
camera.viewportHeight = bg.getHeight();
camera.viewportWidth = bg.getWidth() / (float)height * (float)width;
}
- camera.viewportWidth *= WORLD_RATIO;
- camera.viewportHeight *= WORLD_RATIO;
+ camera.viewportWidth *= ratio;
+ camera.viewportHeight *= ratio;
camera.update();
root.resize(
camera.position.x - (camera.viewportWidth / 2f),
diff --git a/test/src/ch/asynk/gdx/boardgame/test/MenuScreen.java b/test/src/ch/asynk/gdx/boardgame/test/MenuScreen.java
index be9ec72..c0052d4 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/MenuScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/MenuScreen.java
@@ -9,6 +9,7 @@ import ch.asynk.gdx.boardgame.ui.Menu;
public class MenuScreen extends AbstractScreen
{
+ private final float WORLD_RATIO = 0.5f;
private Sprite corner;
private Menu menu;
@@ -63,6 +64,11 @@ public class MenuScreen extends AbstractScreen
corner.draw(batch);
}
+ @Override public void resize(int width, int height)
+ {
+ resize(width, height, WORLD_RATIO);
+ }
+
@Override protected void onZoom(float dz) { }
@Override protected void onDragged(int dx, int dy) { }
@Override protected void onTouch(int x, int y)
diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
index 5292af8..c2b503b 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
@@ -10,6 +10,7 @@ import ch.asynk.gdx.boardgame.ui.Button;
public class UiScreen extends AbstractScreen
{
+ private final float WORLD_RATIO = 0.5f;
private Button hello;
public UiScreen(final GdxBoardTest app)
@@ -90,6 +91,11 @@ public class UiScreen extends AbstractScreen
hello.draw(batch);
}
+ @Override public void resize(int width, int height)
+ {
+ resize(width, height, WORLD_RATIO);
+ }
+
@Override protected void onZoom(float dz) { }
@Override protected void onDragged(int dx, int dy) { }
@Override protected void onTouch(int x, int y)