diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-17 22:20:13 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-18 11:11:36 +0100 |
commit | 791b70c479b7f0b6582a58e38a33321af8b1828b (patch) | |
tree | 557640a53d5f0dcfc654609a5f21f95912676af2 /core/src/ch/asynk | |
parent | 178fbdbf4ce1e37f4db179a0de14ae19b01923d2 (diff) | |
download | RustAndDust-791b70c479b7f0b6582a58e38a33321af8b1828b.zip RustAndDust-791b70c479b7f0b6582a58e38a33321af8b1828b.tar.gz |
Hud: add options button, not implemented yet
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Hud.java | 15 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/State.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/Factory.java | 1 |
3 files changed, 18 insertions, 1 deletions
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"; |