summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-17 22:20:13 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-18 11:11:36 +0100
commit791b70c479b7f0b6582a58e38a33321af8b1828b (patch)
tree557640a53d5f0dcfc654609a5f21f95912676af2
parent178fbdbf4ce1e37f4db179a0de14ae19b01923d2 (diff)
downloadRustAndDust-791b70c479b7f0b6582a58e38a33321af8b1828b.zip
RustAndDust-791b70c479b7f0b6582a58e38a33321af8b1828b.tar.gz
Hud: add options button, not implemented yet
-rw-r--r--android/assets/data/hud.atlas7
-rw-r--r--android/assets/data/hud.pngbin93061 -> 99795 bytes
-rw-r--r--assets/hud/options.pngbin0 -> 5989 bytes
-rw-r--r--core/src/ch/asynk/rustanddust/game/Hud.java15
-rw-r--r--core/src/ch/asynk/rustanddust/game/State.java3
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Factory.java1
6 files changed, 25 insertions, 1 deletions
diff --git a/android/assets/data/hud.atlas b/android/assets/data/hud.atlas
index 08199ed..590038f 100644
--- a/android/assets/data/hud.atlas
+++ b/android/assets/data/hud.atlas
@@ -53,6 +53,13 @@ ok
orig: 48, 47
offset: 0, 0
index: -1
+options
+ rotate: false
+ xy: 138, 58
+ size: 48, 47
+ orig: 48, 47
+ offset: 0, 0
+ index: -1
promote
rotate: false
xy: 84, 28
diff --git a/android/assets/data/hud.png b/android/assets/data/hud.png
index 951b061..cf24f0e 100644
--- a/android/assets/data/hud.png
+++ b/android/assets/data/hud.png
Binary files differ
diff --git a/assets/hud/options.png b/assets/hud/options.png
new file mode 100644
index 0000000..535161d
--- /dev/null
+++ b/assets/hud/options.png
Binary files differ
diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java
index 77b9f71..3ced3dd 100644
--- a/core/src/ch/asynk/rustanddust/game/Hud.java
+++ b/core/src/ch/asynk/rustanddust/game/Hud.java
@@ -14,6 +14,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ch.asynk.rustanddust.engine.gfx.Animation;
import ch.asynk.rustanddust.game.State.StateType;
import ch.asynk.rustanddust.ui.Position;
+import ch.asynk.rustanddust.ui.Bg;
import ch.asynk.rustanddust.ui.Msg;
import ch.asynk.rustanddust.ui.OkCancel;
import ch.asynk.rustanddust.ui.Widget;
@@ -41,6 +42,7 @@ public class Hud implements Disposable, Animation
private float delay;
private boolean delayOn;
private Msg msg;
+ private Bg optionsBtn;
private StatisticsPanel stats;
private EngagementPanel engagement;
private OkCancel okCancel;
@@ -66,6 +68,7 @@ public class Hud implements Disposable, Animation
actionButtons = new ActionButtons(game);
actionButtons.hide();
msg = new Msg(game.font, game.ninePatch, 20f);
+ optionsBtn = new Bg(game.factory.getHudRegion(game.factory.ACT_OPTIONS));
okCancel = new OkCancel(game.font, game.ninePatch, game.factory.getHudRegion(game.factory.ACT_DONE), game.factory.getHudRegion(game.factory.ACT_ABORT));
stats = new StatisticsPanel(game);
engagement = new EngagementPanel(game);
@@ -77,6 +80,7 @@ public class Hud implements Disposable, Animation
playerInfo.dispose();
actionButtons.dispose();
msg.dispose();
+ optionsBtn.dispose();
okCancel.dispose();
engagement.dispose();
stats.dispose();
@@ -88,6 +92,7 @@ public class Hud implements Disposable, Animation
playerInfo.updatePosition();
actionButtons.updatePosition();
msg.updatePosition();
+ optionsBtn.setPosition(ctrl.battle.getHudPosition().verticalMirror().horizontalMirror());
stats.updatePosition();
engagement.updatePosition();
okCancel.updatePosition();
@@ -98,6 +103,7 @@ public class Hud implements Disposable, Animation
Position position = ctrl.battle.getHudPosition();
playerInfo.update(ctrl.battle.getPlayer(), position);
actionButtons.update(position.horizontalMirror());
+ optionsBtn.setPosition(position.verticalMirror().horizontalMirror());
}
@Override
@@ -128,6 +134,7 @@ public class Hud implements Disposable, Animation
playerInfo.draw(batch);
actionButtons.draw(batch);
msg.draw(batch);
+ optionsBtn.draw(batch);
okCancel.draw(batch);
engagement.draw(batch);
stats.draw(batch);
@@ -139,6 +146,7 @@ public class Hud implements Disposable, Animation
playerInfo.drawDebug(debugShapes);
actionButtons.drawDebug(debugShapes);
msg.drawDebug(debugShapes);
+ optionsBtn.drawDebug(debugShapes);
okCancel.drawDebug(debugShapes);
engagement.drawDebug(debugShapes);
stats.drawDebug(debugShapes);
@@ -191,6 +199,8 @@ public class Hud implements Disposable, Animation
hit = actionButtons;
else if (playerInfo.touchDown(x, y))
hit = playerInfo;
+ else if (optionsBtn.hit(x, y))
+ hit = optionsBtn;
}
return (hit != null);
@@ -215,6 +225,11 @@ public class Hud implements Disposable, Animation
else if (hit == playerInfo) {
playerInfo.touchUp(x, y);
}
+ else if (hit == optionsBtn) {
+ if (optionsBtn.hit(x, y)) {
+ System.err.println("Options Not Implemented yet");
+ }
+ }
hit = null;
}
diff --git a/core/src/ch/asynk/rustanddust/game/State.java b/core/src/ch/asynk/rustanddust/game/State.java
index 386df8b..cc7ea9c 100644
--- a/core/src/ch/asynk/rustanddust/game/State.java
+++ b/core/src/ch/asynk/rustanddust/game/State.java
@@ -15,7 +15,8 @@ public interface State
WITHDRAW,
ABORT,
DONE,
- TURN_OVER
+ TURN_OVER,
+ OPTIONS
};
public void enter(StateType prevState);
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
index 020231f..a2833d0 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
@@ -28,6 +28,7 @@ public class Factory implements Board.TileBuilder, Disposable
public static final String ACT_DONE = "ok";
public static final String ACT_ABORT = "cancel";
public static final String ACT_PROMOTE = "promote";
+ public static final String ACT_OPTIONS = "options";
public static final String DISABLED = "disabled";
public static final String REINFORCEMENT = "reinforcement";
public static final String REINFORCEMENT_SELECTED = "reinforcement-selected";