summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-08 12:10:00 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-08 12:10:00 +0100
commitf71f31fc26f1e7898c3ce3a8a4bba7e9f5072106 (patch)
treef17eea0417c0ce1c06c2118c3da57877baa382be /core/src/ch/asynk/tankontank
parent1f677a6d9dc629048a2fea532500ee5d1c32d094 (diff)
downloadRustAndDust-f71f31fc26f1e7898c3ce3a8a4bba7e9f5072106.zip
RustAndDust-f71f31fc26f1e7898c3ce3a8a4bba7e9f5072106.tar.gz
Button: 3 states are UP/DOWN/ON
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Button.java38
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];