diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 19:18:07 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-24 19:18:07 +0100 |
commit | 4e84edbf55e8ac24fbe78e86395bfea189bec187 (patch) | |
tree | 43f564ce028a2580e1662a822bee2630db132ad4 /core/src/ch/asynk/rustanddust/screens | |
parent | 3d7c5a8f04db00072d591fdc3e824c2c53fafdc0 (diff) | |
download | RustAndDust-4e84edbf55e8ac24fbe78e86395bfea189bec187.zip RustAndDust-4e84edbf55e8ac24fbe78e86395bfea189bec187.tar.gz |
State: replace touchUp() and touchDown() with touch(Hex)
Diffstat (limited to 'core/src/ch/asynk/rustanddust/screens')
-rw-r--r-- | core/src/ch/asynk/rustanddust/screens/GameScreen.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/core/src/ch/asynk/rustanddust/screens/GameScreen.java b/core/src/ch/asynk/rustanddust/screens/GameScreen.java index 53f079a..6c58c1b 100644 --- a/core/src/ch/asynk/rustanddust/screens/GameScreen.java +++ b/core/src/ch/asynk/rustanddust/screens/GameScreen.java @@ -14,6 +14,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.math.Vector3; import ch.asynk.rustanddust.RustAndDust; @@ -44,6 +45,8 @@ public class GameScreen implements Screen private boolean blocked; private float inputDelay = 0f; private Vector2 dragPos = new Vector2(); + private Vector3 hudTouch = new Vector3(); + private Vector3 mapTouch = new Vector3(); public GameScreen(final RustAndDust game) { @@ -87,8 +90,8 @@ public class GameScreen implements Screen int dx = (int) (dragPos.x - x); int dy = (int) (dragPos.y - y); dragPos.set(x, y); - cam.unprojectHud(x, y, ctrl.hudTouch); - if (!ctrl.drag(-dx, dy)) + cam.unprojectHud(x, y, hudTouch); + if (!ctrl.drag(hudTouch.x, hudTouch.y, -dx, dy)) cam.translate(dx, dy); return true; } @@ -98,9 +101,9 @@ public class GameScreen implements Screen if (blocked) return true; if (button == Input.Buttons.LEFT) { dragPos.set(x, y); - cam.unproject(x, y, ctrl.mapTouch); - cam.unprojectHud(x, y, ctrl.hudTouch); - ctrl.touchDown(); + cam.unproject(x, y, mapTouch); + cam.unprojectHud(x, y, hudTouch); + ctrl.touchDown(hudTouch.x, hudTouch.y, mapTouch.x, mapTouch.y); } return true; } @@ -114,9 +117,9 @@ public class GameScreen implements Screen } dragged = 0; if (button == Input.Buttons.LEFT) { - cam.unproject(x, y, ctrl.mapTouch); - cam.unprojectHud(x, y, ctrl.hudTouch); - ctrl.touchUp(); + cam.unproject(x, y, mapTouch); + cam.unprojectHud(x, y, hudTouch); + ctrl.touchUp(hudTouch.x, hudTouch.y, mapTouch.x, mapTouch.y); } return true; } |