diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-09 22:07:48 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-09 22:07:48 +0100 |
commit | 37894a65c71227a728439542e0013e76ae84286a (patch) | |
tree | a813e7dc6f43b595182e733c9682f596fe62c363 /core/src/ch/asynk/rustanddust/game | |
parent | 7eb60cf7f72d34e95ff7388713121050366a774e (diff) | |
download | RustAndDust-37894a65c71227a728439542e0013e76ae84286a.zip RustAndDust-37894a65c71227a728439542e0013e76ae84286a.tar.gz |
Ctrl: reorder code
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Ctrl.java | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 0d414bc..3183d4c 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -90,6 +90,42 @@ public class Ctrl implements Disposable map.dispose(); } + // INPUTS + + public boolean drag(int dx, int dy) + { + if (!blockHud && hud.drag(hudTouch.x, hudTouch.y, dx, dy)) + return true; + return false; + } + + public void touchDown() + { + boolean inAnimation = (this.stateType == StateType.ANIMATION); + + if (!blockHud && hud.touchDown(hudTouch.x, hudTouch.y, inAnimation)) + return; + + if (!blockMap && state.downInMap(mapTouch.x, mapTouch.y)) + state.touchDown(); + } + + public void touchUp() + { + if (!blockHud && hud.touchUp(hudTouch.x, hudTouch.y)) + return; + + if (!blockMap && state.upInMap(mapTouch.x, mapTouch.y)) + state.touchUp(); + } + + public void stateTouchUp() + { + state.downInMap(-1, -1); + state.upInMap(-1, -1); + state.touchUp(); + } + private void turnDone() { if (battle.turnDone()) @@ -212,40 +248,6 @@ public class Ctrl implements Disposable } - public boolean drag(int dx, int dy) - { - if (!blockHud && hud.drag(hudTouch.x, hudTouch.y, dx, dy)) - return true; - return false; - } - - public void touchDown() - { - boolean inAnimation = (this.stateType == StateType.ANIMATION); - - if (!blockHud && hud.touchDown(hudTouch.x, hudTouch.y, inAnimation)) - return; - - if (!blockMap && state.downInMap(mapTouch.x, mapTouch.y)) - state.touchDown(); - } - - public void touchUp() - { - if (!blockHud && hud.touchUp(hudTouch.x, hudTouch.y)) - return; - - if (!blockMap && state.upInMap(mapTouch.x, mapTouch.y)) - state.touchUp(); - } - - public void stateTouchUp() - { - state.downInMap(-1, -1); - state.upInMap(-1, -1); - state.touchUp(); - } - public void setAfterAnimationState(StateType after) { stateAfterAnimation = after; |