summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-03 10:17:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-03 10:17:11 +0200
commita52a736fcc0025847ffe6647db7c64f4e31b4799 (patch)
tree001a013f8c71f1a2ee2d284df211549f70819032
parentc404eb10e8c49fd89d7a6a08fab429eec8fb3e14 (diff)
downloadRustAndDust-a52a736fcc0025847ffe6647db7c64f4e31b4799.zip
RustAndDust-a52a736fcc0025847ffe6647db7c64f4e31b4799.tar.gz
GameState: remove drag(float dx, float dy) and clean up
-rw-r--r--core/src/ch/asynk/tankontank/game/GameCtrl.java5
-rw-r--r--core/src/ch/asynk/tankontank/game/GameState.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/GameStateDirection.java15
-rw-r--r--core/src/ch/asynk/tankontank/game/GameStateNone.java14
-rw-r--r--core/src/ch/asynk/tankontank/game/GameStatePath.java14
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java6
6 files changed, 2 insertions, 56 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java
index 356e4eb..cdbced1 100644
--- a/core/src/ch/asynk/tankontank/game/GameCtrl.java
+++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java
@@ -50,9 +50,4 @@ public class GameCtrl
if (GameStateCommon.up(x, y))
state.touchUp();
}
-
- public boolean drag(float dx, float dy)
- {
- return state.drag(dx, dy);
- }
}
diff --git a/core/src/ch/asynk/tankontank/game/GameState.java b/core/src/ch/asynk/tankontank/game/GameState.java
index b53195a..af434ef 100644
--- a/core/src/ch/asynk/tankontank/game/GameState.java
+++ b/core/src/ch/asynk/tankontank/game/GameState.java
@@ -8,11 +8,7 @@ public interface GameState
DIRECTION
};
- public void abort();
-
public void touchDown();
public void touchUp();
-
- public boolean drag(float dx, float dy);
}
diff --git a/core/src/ch/asynk/tankontank/game/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/GameStateDirection.java
index 733ccab..5b98e39 100644
--- a/core/src/ch/asynk/tankontank/game/GameStateDirection.java
+++ b/core/src/ch/asynk/tankontank/game/GameStateDirection.java
@@ -3,27 +3,12 @@ package ch.asynk.tankontank.game;
public class GameStateDirection implements GameState
{
@Override
- public boolean drag(float dx, float dy)
- {
- return false;
- }
-
- @Override
public void touchDown()
{
- System.out.println("GameStateDirection: touchDown()");
- // enableOverlayOn(to.x, to.y, Hex.ROSE, enable);
}
@Override
public void touchUp()
{
- System.out.println("GameStateDirection: touchUp()");
- }
-
- @Override
- public void abort()
- {
- System.err.println("GameStateDirection: abort");
}
}
diff --git a/core/src/ch/asynk/tankontank/game/GameStateNone.java b/core/src/ch/asynk/tankontank/game/GameStateNone.java
index 61a9d21..1d7789a 100644
--- a/core/src/ch/asynk/tankontank/game/GameStateNone.java
+++ b/core/src/ch/asynk/tankontank/game/GameStateNone.java
@@ -15,15 +15,8 @@ public class GameStateNone extends GameStateCommon
}
@Override
- public boolean drag(float dx, float dy)
- {
- return false;
- }
-
- @Override
public void touchDown()
{
- System.out.println("GameStateNone: touchDown()");
if (map.isInPossibleMoves(downHex)) {
ctrl.setState(State.PATH, true);
} else {
@@ -42,14 +35,7 @@ public class GameStateNone extends GameStateCommon
@Override
public void touchUp()
{
- System.out.println("GameStateNone: touchUp()");
if (!hexHasUnit())
unselectHex();
}
-
- @Override
- public void abort()
- {
- System.err.println("GameStateNone: abort");
- }
}
diff --git a/core/src/ch/asynk/tankontank/game/GameStatePath.java b/core/src/ch/asynk/tankontank/game/GameStatePath.java
index 808cbee..c13c14a 100644
--- a/core/src/ch/asynk/tankontank/game/GameStatePath.java
+++ b/core/src/ch/asynk/tankontank/game/GameStatePath.java
@@ -8,15 +8,8 @@ public class GameStatePath extends GameStateCommon
private GridPoint2 to = new GridPoint2(-1, -1);
@Override
- public boolean drag(float dx, float dy)
- {
- return false;
- }
-
- @Override
public void touchDown()
{
- System.out.println("GameStatePath: touchDown()");
int s = map.possiblePathsSize();
if (s == 0) {
s = buildPaths();
@@ -37,13 +30,6 @@ public class GameStatePath extends GameStateCommon
@Override
public void touchUp()
{
- System.out.println("GameStatePath: touchUp()");
- }
-
- @Override
- public void abort()
- {
- System.err.println("GameStatePath: abort");
}
private int buildPaths()
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java
index 41f4be6..9e3bff5 100644
--- a/core/src/ch/asynk/tankontank/screens/GameScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java
@@ -144,10 +144,8 @@ public class GameScreen implements Screen
float deltaX = ((x - dragPos.x) * cam.zoom * screenToWorld.x);
float deltaY = ((dragPos.y - y) * cam.zoom * screenToWorld.y);
dragPos.set(x, y);
- if (!ctrl.drag(deltaX, deltaY)) {
- cam.translate(-deltaX, -deltaY, 0);
- clampCameraPos();
- }
+ cam.translate(-deltaX, -deltaY, 0);
+ clampCameraPos();
return true;
}
@Override