summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/UnitDock.java18
2 files changed, 16 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 32c8d03..9a38cfe 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -73,7 +73,7 @@ public class Hud implements Disposable
turns = new TextImage(atlas.findRegion("turns"), game.skin.getFont("default-font"), "0");
aps = new TextImage(atlas.findRegion("aps"), game.skin.getFont("default-font"), "0");
reinforcement = new TextImage(atlas.findRegion("reinforcement"), game.skin.getFont("default-font"), "0");
- unitDock = new UnitDock(ctrl, atlas.findRegion("disabled"));
+ unitDock = new UnitDock(ctrl, atlas.findRegion("disabled"), atlas.findRegion("reinforcement-selected"));
float x = OFFSET;
float y = (Gdx.graphics.getHeight() - OFFSET);
diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
index 49189f2..e298742 100644
--- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
+++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
@@ -8,6 +8,7 @@ import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Rectangle;
+import ch.asynk.tankontank.engine.gfx.Image;
import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.Orientation;
import ch.asynk.tankontank.game.Ctrl;
@@ -26,15 +27,16 @@ public class UnitDock extends Bg
public boolean show;
public boolean done;
public Pawn selectedPawn;
+ private Image selected;
private List<Pawn> pawns;
private Vector3 point;
private Matrix4 saved;
private Matrix4 transform;
protected Rectangle scaledRect;
- public UnitDock(Ctrl ctrl, TextureRegion region)
+ public UnitDock(Ctrl ctrl, TextureRegion bg, TextureRegion selected)
{
- super(region);
+ super(bg);
this.ctrl = ctrl;
this.visible = false;
this.done = true;
@@ -42,6 +44,8 @@ public class UnitDock extends Bg
this.saved = new Matrix4();
this.transform = new Matrix4();
this.scaledRect = new Rectangle();
+ this.selected = new Image(selected);
+ this.selected.visible = false;
}
public void setTopLeft(float x, float y)
@@ -54,6 +58,7 @@ public class UnitDock extends Bg
public void dispose()
{
super.dispose();
+ selected.dispose();
}
public void toggle()
@@ -147,8 +152,15 @@ public class UnitDock extends Bg
batch.setTransformMatrix(transform);
super.draw(batch);
- for (Pawn pawn : pawns)
+ selected.visible = false;
+ for (Pawn pawn : pawns) {
pawn.draw(batch);
+ if (pawn == selectedPawn) {
+ selected.visible = true;
+ selected.centerOn((pawn.getX() + (pawn.getWidth() / 2)), (pawn.getY() + (pawn.getHeight() / 2)));
+ selected.draw(batch);
+ }
+ }
batch.setTransformMatrix(saved);
}