summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/UnitDock.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
index c249c64..d2d6f91 100644
--- a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
+++ b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
@@ -121,6 +121,7 @@ public class UnitDock extends Bg implements Animation
{
int i = (int) ((scaledRect.y + scaledRect.height - y) / (scaledRect.height / units.size()));
selectedUnit = units.get(i);
+ selected.setCenter((selectedUnit.getX() + (selectedUnit.getWidth() / 2)), (selectedUnit.getY() + (selectedUnit.getHeight() / 2)));
return selectedUnit;
}
@@ -236,13 +237,9 @@ public class UnitDock extends Bg implements Animation
Gdx.gl.glScissor((int)scissors.x, (int)scissors.y, (int)scissors.width, (int)scissors.height);
super.draw(batch);
- for (Unit unit : units) {
- unit.draw(batch);
- if (unit == selectedUnit) {
- selected.setCenter((unit.getX() + (unit.getWidth() / 2)), (unit.getY() + (unit.getHeight() / 2)));
- selected.draw(batch);
- }
- }
+ for (Unit unit : units) unit.draw(batch);
+
+ if (selectedUnit != null) selected.draw(batch);
batch.setTransformMatrix(saved);