summaryrefslogtreecommitdiffstats
path: root/test/src/ch/asynk/gdx/boardgame
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-18 23:11:39 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-18 23:11:39 +0100
commitbe4e58bed776a68d5580f3ad01b3eb07dc628893 (patch)
tree22cae547e28ffe75d1ed78fea6054d2bc7deb630 /test/src/ch/asynk/gdx/boardgame
parentc72d5099fecfa3d3e80568172f6b95c085a32565 (diff)
downloadgdx-boardgame-be4e58bed776a68d5580f3ad01b3eb07dc628893.zip
gdx-boardgame-be4e58bed776a68d5580f3ad01b3eb07dc628893.tar.gz
UiScreen : implement onDragged(...)
Diffstat (limited to 'test/src/ch/asynk/gdx/boardgame')
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/AbstractScreen.java6
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/UiScreen.java7
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