summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Position.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Position.java b/core/src/ch/asynk/tankontank/game/hud/Position.java
index 05159ae..0556aba 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Position.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Position.java
@@ -15,6 +15,100 @@ public enum Position
BOTTOM_RIGHT,
BOTTOM_CENTER;
+ public Position down()
+ {
+ Position p = BOTTOM_LEFT;
+ switch(this) {
+ case TOP_LEFT:
+ case MIDDLE_LEFT:
+ case BOTTOM_LEFT:
+ p = BOTTOM_LEFT;
+ break;
+ case TOP_CENTER:
+ case MIDDLE_CENTER:
+ case BOTTOM_CENTER:
+ p = BOTTOM_CENTER;
+ break;
+ case TOP_RIGHT:
+ case MIDDLE_RIGHT:
+ case BOTTOM_RIGHT:
+ p = BOTTOM_RIGHT;
+ break;
+ }
+ return p;
+ }
+
+ public Position up()
+ {
+ Position p = TOP_LEFT;
+ switch(this) {
+ case TOP_LEFT:
+ case MIDDLE_LEFT:
+ 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;
+ }
+ return p;
+ }
+
+ public boolean isLeft()
+ {
+ boolean r = false;
+ switch(this) {
+ case TOP_LEFT:
+ case MIDDLE_LEFT:
+ case BOTTOM_LEFT:
+ r = true;
+ break;
+ default:
+ r = false;
+ break;
+ }
+ return r;
+ }
+
+ public boolean isRight()
+ {
+ boolean r = false;
+ switch(this) {
+ case TOP_RIGHT:
+ case MIDDLE_RIGHT:
+ case BOTTOM_RIGHT:
+ r = true;
+ break;
+ default:
+ r = false;
+ break;
+ }
+ return r;
+ }
+
+ public boolean isCenter()
+ {
+ boolean r = false;
+ switch(this) {
+ case TOP_CENTER:
+ case MIDDLE_CENTER:
+ case BOTTOM_CENTER:
+ r = true;
+ break;
+ default:
+ r = false;
+ break;
+ }
+ return r;
+ }
+
public float getX(float width)
{
float x;