summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-04 10:17:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-04 10:17:03 +0100
commit556f3e0d54f3489380d48538645e6b392bf4a47e (patch)
treeecfbd29b6f0da13c1f8b7182306cb2ebff5db60a /core
parentabe256df2db166d41d457c2c80d9dece5782de87 (diff)
downloadRustAndDust-556f3e0d54f3489380d48538645e6b392bf4a47e.zip
RustAndDust-556f3e0d54f3489380d48538645e6b392bf4a47e.tar.gz
Button: add void draw(Batch batch)
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java12
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Button.java7
2 files changed, 13 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 225b7e5..1e4f922 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -155,12 +155,12 @@ public class Hud implements Disposable
unitDock.draw(batch);
actionsBg.draw(batch);
- if (moveBtn.visible) moveBtn.getImage().draw(batch);
- if (rotateBtn.visible) rotateBtn.getImage().draw(batch);
- if (promoteBtn.visible) promoteBtn.getImage().draw(batch);
- if (attackBtn.visible) attackBtn.getImage().draw(batch);
- if (checkBtn.visible) checkBtn.getImage().draw(batch);
- if (cancelBtn.visible) cancelBtn.getImage().draw(batch);
+ moveBtn.draw(batch);
+ rotateBtn.draw(batch);
+ promoteBtn.draw(batch);
+ attackBtn.draw(batch);
+ checkBtn.draw(batch);
+ cancelBtn.draw(batch);
msg.draw(batch);
}
diff --git a/core/src/ch/asynk/tankontank/game/hud/Button.java b/core/src/ch/asynk/tankontank/game/hud/Button.java
index ea94c2c..2d344b4 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Button.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Button.java
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Disposable;
+import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Rectangle;
@@ -99,4 +100,10 @@ public class Button implements Disposable
public float getY() { return images[0].getY(); }
public float getWidth() { return images[0].getWidth(); }
public float getHeight() { return images[0].getHeight(); }
+
+ public void draw(Batch batch)
+ {
+ if (!visible) return;
+ getImage().draw(batch);
+ }
}