summaryrefslogtreecommitdiffstats
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
parent1f677a6d9dc629048a2fea532500ee5d1c32d094 (diff)
downloadRustAndDust-f71f31fc26f1e7898c3ce3a8a4bba7e9f5072106.zip
RustAndDust-f71f31fc26f1e7898c3ce3a8a4bba7e9f5072106.tar.gz
Button: 3 states are UP/DOWN/ON
-rw-r--r--android/assets/data/hud.atlas24
-rw-r--r--android/assets/data/hud.pngbin345114 -> 343848 bytes
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Button.java38
-rw-r--r--data/assets/hud/btn-attack-up.png (renamed from data/assets/hud/btn-attack-off.png)bin8509 -> 8509 bytes
-rw-r--r--data/assets/hud/btn-cancel-up.png (renamed from data/assets/hud/btn-cancel-off.png)bin8958 -> 8958 bytes
-rw-r--r--data/assets/hud/btn-check-up.png (renamed from data/assets/hud/btn-check-off.png)bin5272 -> 5272 bytes
-rw-r--r--data/assets/hud/btn-move-up.png (renamed from data/assets/hud/btn-move-off.png)bin7042 -> 7042 bytes
-rw-r--r--data/assets/hud/btn-promote-up.png (renamed from data/assets/hud/btn-promote-off.png)bin5381 -> 5381 bytes
-rw-r--r--data/assets/hud/btn-rotate-up.png (renamed from data/assets/hud/btn-rotate-off.png)bin7234 -> 7234 bytes
9 files changed, 31 insertions, 31 deletions
diff --git a/android/assets/data/hud.atlas b/android/assets/data/hud.atlas
index d890af5..f137d02 100644
--- a/android/assets/data/hud.atlas
+++ b/android/assets/data/hud.atlas
@@ -38,14 +38,14 @@ btn-attack-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-attack-off
+btn-attack-on
rotate: false
xy: 778, 194
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-attack-on
+btn-attack-up
rotate: false
xy: 840, 194
size: 60, 60
@@ -59,14 +59,14 @@ btn-cancel-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-cancel-off
+btn-cancel-on
rotate: false
xy: 254, 68
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-cancel-on
+btn-cancel-up
rotate: false
xy: 254, 6
size: 60, 60
@@ -80,14 +80,14 @@ btn-check-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-check-off
+btn-check-on
rotate: false
xy: 316, 6
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-check-on
+btn-check-up
rotate: false
xy: 378, 68
size: 60, 60
@@ -101,14 +101,14 @@ btn-move-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-move-off
+btn-move-on
rotate: false
xy: 440, 68
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-move-on
+btn-move-up
rotate: false
xy: 440, 6
size: 60, 60
@@ -122,14 +122,14 @@ btn-promote-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-promote-off
+btn-promote-on
rotate: false
xy: 502, 6
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-promote-on
+btn-promote-up
rotate: false
xy: 564, 68
size: 60, 60
@@ -143,14 +143,14 @@ btn-rotate-down
orig: 60, 60
offset: 0, 0
index: -1
-btn-rotate-off
+btn-rotate-on
rotate: false
xy: 716, 132
size: 60, 60
orig: 60, 60
offset: 0, 0
index: -1
-btn-rotate-on
+btn-rotate-up
rotate: false
xy: 778, 132
size: 60, 60
diff --git a/android/assets/data/hud.png b/android/assets/data/hud.png
index 9d3dd4f..35f27e7 100644
--- a/android/assets/data/hud.png
+++ b/android/assets/data/hud.png
Binary files differ
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];
diff --git a/data/assets/hud/btn-attack-off.png b/data/assets/hud/btn-attack-up.png
index 5a29edc..5a29edc 100644
--- a/data/assets/hud/btn-attack-off.png
+++ b/data/assets/hud/btn-attack-up.png
Binary files differ
diff --git a/data/assets/hud/btn-cancel-off.png b/data/assets/hud/btn-cancel-up.png
index 800c983..800c983 100644
--- a/data/assets/hud/btn-cancel-off.png
+++ b/data/assets/hud/btn-cancel-up.png
Binary files differ
diff --git a/data/assets/hud/btn-check-off.png b/data/assets/hud/btn-check-up.png
index 4fb965b..4fb965b 100644
--- a/data/assets/hud/btn-check-off.png
+++ b/data/assets/hud/btn-check-up.png
Binary files differ
diff --git a/data/assets/hud/btn-move-off.png b/data/assets/hud/btn-move-up.png
index f637991..f637991 100644
--- a/data/assets/hud/btn-move-off.png
+++ b/data/assets/hud/btn-move-up.png
Binary files differ
diff --git a/data/assets/hud/btn-promote-off.png b/data/assets/hud/btn-promote-up.png
index 67d7cca..67d7cca 100644
--- a/data/assets/hud/btn-promote-off.png
+++ b/data/assets/hud/btn-promote-up.png
Binary files differ
diff --git a/data/assets/hud/btn-rotate-off.png b/data/assets/hud/btn-rotate-up.png
index f5467b2..f5467b2 100644
--- a/data/assets/hud/btn-rotate-off.png
+++ b/data/assets/hud/btn-rotate-up.png
Binary files differ