diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Button.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Button.java b/core/src/ch/asynk/tankontank/game/hud/Button.java index 4ce1120..08e2f1c 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Button.java +++ b/core/src/ch/asynk/tankontank/game/hud/Button.java @@ -20,19 +20,19 @@ public class Button implements Disposable private Image image; private Rectangle rect; - private static final int OFF = 0; - private static final int ON = 1; - private static final int DOWN = 2; + private static final int UP = 0; + private static final int DOWN = 1; + private static final int ON = 2; public Button(TextureAtlas atlas, String base) { - this.idx = OFF; + this.idx = UP; this.blocked = false; this.visible = false; this.images = new Image[3]; - this.images[OFF] = new Image(atlas.findRegion(base + "-off")); - this.images[ON] = new Image(atlas.findRegion(base + "-on")); + this.images[UP] = new Image(atlas.findRegion(base + "-up")); this.images[DOWN] = new Image(atlas.findRegion(base + "-down")); + this.images[ON] = new Image(atlas.findRegion(base + "-on")); this.rect = new Rectangle(getX(), getY(), getWidth(), getHeight()); } @@ -46,18 +46,13 @@ public class Button implements Disposable public void hide() { - idx = OFF; + setUp(); visible = false; } - public void setOff() - { - idx = OFF; - } - - public void setOn() + public void setUp() { - idx = ON; + idx = UP; } public void setDown() @@ -65,21 +60,26 @@ public class Button implements Disposable idx = DOWN; } - public boolean isOn() + public void setOn() { - return (idx == ON); + idx = ON; } - public boolean isOff() + public boolean isUp() { - return (idx == OFF); + return (idx == UP); } - public boolean isDisabled() + public boolean isDown() { return (idx == DOWN); } + public boolean isOn() + { + return (idx == ON); + } + public Image getImage() { return images[idx]; |