diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index c4dd19b..c9cf00e 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -31,7 +31,7 @@ public class GameScreen implements Screen { private static final boolean DEBUG = false; - private static final float INPUT_DELAY = 0.3f; + private static final float INPUT_DELAY = 0.1f; private static final float ZOOM_IN_MAX = 0.2f; private static final float ZOOM_GESTURE_FACTOR = .01f; private static final float ZOOM_SCROLL_FACTOR = .1f; @@ -52,6 +52,7 @@ public class GameScreen implements Screen private final TankOnTank game; private Ctrl ctrl; + private boolean blocked; private float inputDelay = 0f; private Vector2 dragPos = new Vector2(); private Vector3 touchPos = new Vector3(); @@ -95,6 +96,7 @@ public class GameScreen implements Screen cam.zoom -= ZOOM_GESTURE_FACTOR; cam.zoom = MathUtils.clamp(cam.zoom, ZOOM_IN_MAX, maxZoomOut); clampCameraPos(); + blocked = true; inputDelay = INPUT_DELAY; return true; } @@ -108,6 +110,7 @@ public class GameScreen implements Screen dragPos.set(x, y); cam.translate(-deltaX, -deltaY, 0); clampCameraPos(); + blocked = true; inputDelay = INPUT_DELAY; return true; } @@ -115,6 +118,7 @@ public class GameScreen implements Screen public boolean touchDown(int x, int y, int pointer, int button) { if (inputDelay > 0f) return true; + blocked = false; if (button == Input.Buttons.LEFT) { dragPos.set(x, y); if (ctrl.mayProcessTouch()) { @@ -130,7 +134,7 @@ public class GameScreen implements Screen @Override public boolean touchUp(int x, int y, int pointer, int button) { - if (inputDelay > 0f) return true; + if (blocked) return true; if (button == Input.Buttons.LEFT) { if (ctrl.mayProcessTouch()) { unprojectToHud(x, y, touchPos); @@ -140,6 +144,7 @@ public class GameScreen implements Screen } } } + blocked = true; inputDelay = INPUT_DELAY; return true; } @@ -149,6 +154,7 @@ public class GameScreen implements Screen cam.zoom += amount * ZOOM_SCROLL_FACTOR; cam.zoom = MathUtils.clamp(cam.zoom, ZOOM_IN_MAX, maxZoomOut); clampCameraPos(); + blocked = true; inputDelay = INPUT_DELAY; return true; } |