diff options
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/hud')
5 files changed, 42 insertions, 38 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/hud/ActionButtons.java b/core/src/ch/asynk/rustanddust/game/hud/ActionButtons.java index 05753b8..1948356 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/ActionButtons.java +++ b/core/src/ch/asynk/rustanddust/game/hud/ActionButtons.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.game.Ctrl; import ch.asynk.rustanddust.game.State.StateType; import ch.asynk.rustanddust.ui.Widget; @@ -39,19 +40,19 @@ public class ActionButtons extends Widget private Bg buttons []; private StateType states []; - public ActionButtons(Ctrl ctrl, TextureAtlas uiAtlas, TextureAtlas hudAtlas) + public ActionButtons(RustAndDust game) { - this.bg = new Sprite(uiAtlas.findRegion("disabled")); - this.ctrl = ctrl; + this.bg = new Sprite(game.factory.getHudRegion(game.factory.DISABLED)); + this.ctrl = game.ctrl; this.visible = false; this.position = Position.BOTTOM_RIGHT; this.idx = Buttons.NONE.i; this.buttons = new Bg[Buttons.LAST.i]; - this.buttons[Buttons.DONE.i] = new Bg(hudAtlas.findRegion("ok")); - this.buttons[Buttons.ABORT.i] = new Bg(hudAtlas.findRegion("cancel")); - this.buttons[Buttons.PROMOTE.i] = new Bg(hudAtlas.findRegion("promote")); + this.buttons[Buttons.DONE.i] = new Bg(game.factory.getHudRegion(game.factory.ACT_DONE)); + this.buttons[Buttons.ABORT.i] = new Bg(game.factory.getHudRegion(game.factory.ACT_ABORT)); + this.buttons[Buttons.PROMOTE.i] = new Bg(game.factory.getHudRegion(game.factory.ACT_PROMOTE)); this.states = new StateType[Buttons.LAST.i]; this.states[Buttons.DONE.i] = StateType.DONE; diff --git a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java index 2e114cb..fa6e206 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.game.Engagement; import ch.asynk.rustanddust.game.Army; import ch.asynk.rustanddust.engine.gfx.Animation; @@ -43,17 +44,17 @@ public class EngagementPanel extends Patch implements Animation private DiceAnimation d3Animation; private DiceAnimation d4Animation; - public EngagementPanel(BitmapFont font, TextureAtlas uiAtlas, TextureAtlas hudAtlas) + public EngagementPanel(RustAndDust game) { - super(uiAtlas.createPatch("typewriter")); - usFlag = new Bg(hudAtlas.findRegion("us-flag")); - geFlag = new Bg(hudAtlas.findRegion("ge-flag")); - attackImg = new Bg(hudAtlas.findRegion("attack")); - defenseImg = new Bg(hudAtlas.findRegion("defense")); - this.attack = new Label(font); - this.defense = new Label(font); - this.attackR = new Label(font); - this.defenseR = new Label(font); + super(game.ninePatch); + this.usFlag = new Bg(game.factory.getFlag(Army.US)); + this.geFlag = new Bg(game.factory.getFlag(Army.GE)); + this.attackImg = new Bg(game.factory.getHudRegion(game.factory.PNG_ATTACK)); + this.defenseImg = new Bg(game.factory.getHudRegion(game.factory.PNG_DEFENSE)); + this.attack = new Label(game.font); + this.defense = new Label(game.font); + this.attackR = new Label(game.font); + this.defenseR = new Label(game.font); this.visible = false; int d = (int) Math.max((Gdx.graphics.getWidth() * 0.03f), DICE_DIMENSION); this.d1Animation = new DiceAnimation(d); diff --git a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java index e7718c5..7ba4325 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java @@ -10,6 +10,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import ch.asynk.rustanddust.engine.gfx.Animation; import ch.asynk.rustanddust.engine.gfx.Drawable; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.game.State.StateType; import ch.asynk.rustanddust.game.Ctrl; import ch.asynk.rustanddust.game.Hud; @@ -37,16 +38,16 @@ public class PlayerInfo implements Disposable, Drawable, Animation public UnitDock unitDock; private Position position; - public PlayerInfo(Ctrl ctrl, BitmapFont font, TextureAtlas uiAtlas, TextureAtlas hudAtlas) + public PlayerInfo(RustAndDust game) { - this.ctrl = ctrl; + this.ctrl = game.ctrl; this.position = Position.MIDDLE_CENTER; - usFlag = new Bg(hudAtlas.findRegion("us-flag")); - geFlag = new Bg(hudAtlas.findRegion("ge-flag")); - turns = new LabelImage(hudAtlas.findRegion("turns"), font, 5f); - aps = new LabelImage(hudAtlas.findRegion("aps"), font, 5f); - reinforcement = new LabelImage(hudAtlas.findRegion("reinforcement"), font, 5f); - unitDock = new UnitDock(ctrl, uiAtlas.findRegion("disabled"), hudAtlas.findRegion("reinforcement-selected"), 10f); + usFlag = new Bg(game.factory.getFlag(Army.US)); + geFlag = new Bg(game.factory.getFlag(Army.GE)); + turns = new LabelImage(game.factory.getHudRegion(game.factory.HUD_TURNS), game.font, 5f); + aps = new LabelImage(game.factory.getHudRegion(game.factory.HUD_APS), game.font, 5f); + reinforcement = new LabelImage(game.factory.getHudRegion(game.factory.REINFORCEMENT), game.font, 5f); + unitDock = new UnitDock(game, 10f); } @Override diff --git a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java index 05c4c23..20b6621 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.game.Player; import ch.asynk.rustanddust.game.Army; import ch.asynk.rustanddust.ui.Bg; @@ -27,16 +28,16 @@ public class StatisticsPanel extends Patch private Bg geFlag; private Bg usFlag; - public StatisticsPanel(BitmapFont font, TextureAtlas uiAtlas, TextureAtlas hudAtlas) + public StatisticsPanel(RustAndDust game) { - super(uiAtlas.createPatch("typewriter")); - this.title = new Label(font); - this.header = new Label(font); - this.stats1 = new Label(font); - this.stats2 = new Label(font); - this.okBtn = new Bg(uiAtlas.findRegion("ok")); - this.geFlag = new Bg(hudAtlas.findRegion("ge-flag")); - this.usFlag = new Bg(hudAtlas.findRegion("us-flag")); + super(game.ninePatch); + this.title = new Label(game.font); + this.header = new Label(game.font); + this.stats1 = new Label(game.font); + this.stats2 = new Label(game.font); + this.okBtn = new Bg(game.factory.getHudRegion(game.factory.ACT_DONE)); + this.usFlag = new Bg(game.factory.getFlag(Army.US)); + this.geFlag = new Bg(game.factory.getFlag(Army.GE)); this.visible = false; this.header.write("\nActions\nUnits Left\nUnits Withrawed\nCasualties\nObjectives"); } diff --git a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java index bc20c53..7b9e5f9 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java +++ b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java @@ -3,13 +3,13 @@ package ch.asynk.rustanddust.game.hud; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Rectangle; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.engine.gfx.Animation; import ch.asynk.rustanddust.engine.Orientation; import ch.asynk.rustanddust.game.Player; @@ -44,10 +44,10 @@ public class UnitDock extends Bg implements Animation private Rectangle scaledRect; private Rectangle scissors; - public UnitDock(Ctrl ctrl, TextureRegion region, TextureRegion selected, float padding) + public UnitDock(RustAndDust game, float padding) { - super(region); - this.ctrl = ctrl; + super(game.factory.getHudRegion(game.factory.DISABLED)); + this.ctrl = game.ctrl; this.padding = padding; this.mvtDone = true; this.point = new Vector3(); @@ -55,7 +55,7 @@ public class UnitDock extends Bg implements Animation this.transform = new Matrix4(); this.scaledRect = new Rectangle(); this.scissors = new Rectangle(); - this.selected = new Sprite(selected); + this.selected = new Sprite(game.factory.getHudRegion(game.factory.REINFORCEMENT_SELECTED)); this.visible = false; this.dx = 0f; this.dy = 0f; |