summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-06 12:22:20 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-06 12:22:20 +0100
commitcfe2a6055379bda9410031b09328f6a2f656d7c3 (patch)
tree923be503a18af1a46ee7c0401ae99ee6c26d35d7 /core/src/ch
parent0ed98a8a3c3dbd66d80b6c13dbb8c94b850ca7cd (diff)
downloadRustAndDust-cfe2a6055379bda9410031b09328f6a2f656d7c3.zip
RustAndDust-cfe2a6055379bda9410031b09328f6a2f656d7c3.tar.gz
GameScreen: do not send touchUp at the end of dragging
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java
index 0eb16a7..c5129c5 100644
--- a/core/src/ch/asynk/tankontank/screens/GameScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java
@@ -38,6 +38,7 @@ public class GameScreen implements Screen
private final TankOnTank game;
private Ctrl ctrl;
+ private boolean dragged;
private boolean blocked;
private float inputDelay = 0f;
private Vector2 dragPos = new Vector2();
@@ -47,6 +48,7 @@ public class GameScreen implements Screen
DEBUG = game.config.debug;
this.game = game;
+ this.dragged = false;
this.blocked = false;
this.batch = new SpriteBatch();
@@ -80,6 +82,7 @@ public class GameScreen implements Screen
@Override
public boolean touchDragged(int x, int y, int pointer)
{
+ dragged = true;
cam.translate((dragPos.x - x), (dragPos.y - y));
dragPos.set(x, y);
return true;
@@ -100,6 +103,10 @@ public class GameScreen implements Screen
public boolean touchUp(int x, int y, int pointer, int button)
{
if (blocked) return true;
+ if (dragged) {
+ dragged = false;
+ return true;
+ }
if (button == Input.Buttons.LEFT) {
cam.unproject(x, y, ctrl.mapTouch);
cam.unprojectHud(x, y, ctrl.hudTouch);