diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 12 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Button.java | 7 |
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); + } } |