diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 12:00:57 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 12:00:57 +0200 |
commit | c47b62c26608f04139488354440d1c9167b779a7 (patch) | |
tree | 615b4f765fd988f39912c59c4abaa474893b6de0 | |
parent | 37e511aa4e3020136c85762f4d4d923eb81ca8b8 (diff) | |
download | RustAndDust-c47b62c26608f04139488354440d1c9167b779a7.zip RustAndDust-c47b62c26608f04139488354440d1c9167b779a7.tar.gz |
Hud: fix buttons background
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 381f7a6..989df4c 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -19,6 +19,7 @@ import ch.asynk.tankontank.TankOnTank; public class Hud implements Disposable { private static final float OFFSET = 15f; + private static final float PADDING = 5f; private final TankOnTank game; private final Ctrl ctrl; @@ -37,13 +38,13 @@ public class Hud implements Disposable private Msg msg; private Rectangle infoRect; - private Vector2 bottomLeft; + private Vector2 corner; public Hud(final Ctrl ctrl, final TankOnTank game) { this.game = game; this.ctrl = ctrl; - this.bottomLeft = new Vector2((Gdx.graphics.getWidth() - OFFSET), OFFSET); + this.corner = new Vector2((Gdx.graphics.getWidth() - OFFSET), OFFSET); TextureAtlas atlas = game.manager.get("data/assets.atlas", TextureAtlas.class); @@ -110,13 +111,13 @@ public class Hud implements Disposable // btn.setOff(); btn.visible = true; btn.setPosition(x, y); - return (y + btn.getHeight() + OFFSET); + return (y + btn.getHeight() + PADDING); } public void show(boolean promote, boolean rotate, boolean move, boolean attack, boolean check, boolean cancel) { - float x = (bottomLeft.x - checkBtn.getWidth()); - float y = bottomLeft.y; + float x = (corner.x - checkBtn.getWidth()); + float y = corner.y; if (move) y = setButton(moveBtn, x, y); else moveBtn.hide(); @@ -131,7 +132,7 @@ public class Hud implements Disposable if (check) y = setButton(checkBtn, x, y); else checkBtn.hide(); - bg.set(x, bottomLeft.y, checkBtn.getWidth(), (y - bottomLeft.y)); + bg.set((x - PADDING), (corner.y - PADDING), (checkBtn.getWidth() + (2 * PADDING)), (y - corner.y)); } public void hide() |