summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-04 12:04:57 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-04 12:04:57 +0100
commitbad406403c341969140934ba6ace9805f4aae46a (patch)
tree1015373254848fddc67a4e5799996f06b2478b8b /core
parent18a5f076af623976833facf6a09e3ead83c59a69 (diff)
downloadRustAndDust-bad406403c341969140934ba6ace9805f4aae46a.zip
RustAndDust-bad406403c341969140934ba6ace9805f4aae46a.tar.gz
UnitDock: track the last selected Pawn in public Pawn selectedPawn;
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/UnitDock.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
index 4af7272..c90ae81 100644
--- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
+++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
@@ -25,6 +25,7 @@ public class UnitDock extends Bg
public boolean visible;
public boolean show;
public boolean done;
+ public Pawn selectedPawn;
private List<Pawn> pawns;
private Vector3 point;
private Matrix4 saved;
@@ -72,7 +73,13 @@ public class UnitDock extends Bg
@Override
public boolean hit(float x, float y)
{
- return scaledRect.contains(x, y);
+ if (scaledRect.contains(x, y)) {
+ int i = (int) ((scaledRect.y + scaledRect.height - y) / (scaledRect.height / pawns.size()));
+ selectedPawn = pawns.get(i);
+ return true;
+ }
+ selectedPawn = null;
+ return false;
}
public void show()
@@ -85,6 +92,7 @@ public class UnitDock extends Bg
rect.y = y - rect.height;
}
+ selectedPawn = null;
to = x;
show = true;
done = false;