From 0457ab6e2494d3e4c9574a6df2c861e6804f3746 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Wed, 12 Nov 2014 16:19:27 +0100 Subject: GameScreen,Ctrl: send hud and map coordinates to Ctrl.touchUp/Down --- core/src/ch/asynk/tankontank/screens/GameScreen.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'core/src/ch/asynk/tankontank/screens') diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 2eb38102..9e827648 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -56,7 +56,8 @@ public class GameScreen implements Screen // private boolean blocked; // private float inputDelay = 0f; private Vector2 dragPos = new Vector2(); - private Vector3 touchPos = new Vector3(); + private Vector3 mapTouch = new Vector3(); + private Vector3 hudTouch = new Vector3(); private Vector2 screenToWorld = new Vector2(); public GameScreen(final TankOnTank game) @@ -123,11 +124,9 @@ public class GameScreen implements Screen if (button == Input.Buttons.LEFT) { dragPos.set(x, y); if (ctrl.mayProcessTouch()) { - unprojectToHud(x, y, touchPos); - if (!ctrl.hud.touchDown(touchPos.x, touchPos.y)) { - unprojectToMap(x, y, touchPos); - ctrl.touchDown(touchPos.x, touchPos.y); - } + unprojectToHud(x, y, hudTouch); + unprojectToMap(x, y, mapTouch); + ctrl.touchDown(hudTouch.x, hudTouch.y, mapTouch.x, mapTouch.y); } } return true; @@ -138,11 +137,9 @@ public class GameScreen implements Screen // if (blocked) return true; if (button == Input.Buttons.LEFT) { if (ctrl.mayProcessTouch()) { - unprojectToHud(x, y, touchPos); - if (!ctrl.hud.touchUp(touchPos.x, touchPos.y)) { - unprojectToMap(x, y, touchPos); - ctrl.touchUp(touchPos.x, touchPos.y); - } + unprojectToHud(x, y, hudTouch); + unprojectToMap(x, y, mapTouch); + ctrl.touchUp(hudTouch.x, hudTouch.y, mapTouch.x, mapTouch.y); } } // blocked = true; -- cgit v1.2.3