diff options
-rw-r--r-- | test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java | 6 | ||||
-rw-r--r-- | test/src/ch/asynk/gdx/boardgame/test/UiScreen.java | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java index deb8dca..1c1273a 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java @@ -26,9 +26,9 @@ public abstract class AbstractScreen implements Screen private static final float ZOOM_SCROLL_FACTOR = .1f; private static final float ZOOM_GESTURE_FACTOR = .01f; - protected final Vector2 dragPos = new Vector2(); - protected final Vector3 boardTouch = new Vector3(); - protected final Vector3 hudTouch = new Vector3(); + protected final Vector2 dragPos = new Vector2(0, 0); + protected final Vector3 boardTouch = new Vector3(0, 0, 0); + protected final Vector3 hudTouch = new Vector3(0, 0, 0); private ShapeRenderer shapeRenderer = null; diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java index ec06a3f..6ce119e 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java @@ -123,7 +123,6 @@ public class UiScreen extends AbstractScreen } @Override protected void onZoom(float dz) { } - @Override protected void onDragged(int dx, int dy) { } @Override protected void onTouch(int x, int y) { hudTouch.set(x, y, 0); @@ -133,6 +132,12 @@ public class UiScreen extends AbstractScreen setState(state.next()); } } + @Override protected void onDragged(int dx, int dy) + { + hudTouch.set(dragPos.x, dragPos.y, 0); + camera.unproject(hudTouch); + root.drag(hudTouch.x, hudTouch.y, -dx, dy); + } } class MyButton extends Button |