From 08d56f3b3f18d6c3863bda91f876daa6e62e415c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 22 Nov 2014 23:10:43 +0100 Subject: hud/Position: replace up() down() with horizontal/verticalMirror() --- core/src/ch/asynk/tankontank/game/Hud.java | 2 +- .../src/ch/asynk/tankontank/game/hud/Position.java | 38 +++++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 7c31aa0..49b8a34 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -76,7 +76,7 @@ public class Hud implements Disposable { Position position = ctrl.battle.getHudPosition(ctrl.player); playerInfo.update(ctrl.player, position); - actionButtons.setPosition(position.down()); + actionButtons.setPosition(position.horizontalMirror()); } public void animate(float delta) diff --git a/core/src/ch/asynk/tankontank/game/hud/Position.java b/core/src/ch/asynk/tankontank/game/hud/Position.java index 0556aba..4f490bd 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Position.java +++ b/core/src/ch/asynk/tankontank/game/hud/Position.java @@ -15,45 +15,51 @@ public enum Position BOTTOM_RIGHT, BOTTOM_CENTER; - public Position down() + public Position verticalMirror() { - Position p = BOTTOM_LEFT; + Position p = this; switch(this) { case TOP_LEFT: + p = TOP_RIGHT; + break; case MIDDLE_LEFT: - case BOTTOM_LEFT: - p = BOTTOM_LEFT; + p = MIDDLE_RIGHT; break; - case TOP_CENTER: - case MIDDLE_CENTER: - case BOTTOM_CENTER: - p = BOTTOM_CENTER; + case BOTTOM_LEFT: + p = BOTTOM_RIGHT; break; case TOP_RIGHT: + p = TOP_LEFT; + break; case MIDDLE_RIGHT: + p = MIDDLE_LEFT; + break; case BOTTOM_RIGHT: - p = BOTTOM_RIGHT; + p = BOTTOM_LEFT; break; } return p; } - public Position up() + public Position horizontalMirror() { - Position p = TOP_LEFT; + Position p = this; switch(this) { case TOP_LEFT: - case MIDDLE_LEFT: + p = BOTTOM_LEFT; + break; + case TOP_CENTER: + p = BOTTOM_CENTER; + break; + case TOP_RIGHT: + p = BOTTOM_RIGHT; + break; case BOTTOM_LEFT: p = TOP_LEFT; break; - case TOP_CENTER: - case MIDDLE_CENTER: case BOTTOM_CENTER: p = TOP_CENTER; break; - case TOP_RIGHT: - case MIDDLE_RIGHT: case BOTTOM_RIGHT: p = TOP_RIGHT; break; -- cgit v1.1-2-g2b99