summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-17 13:58:02 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-18 11:11:05 +0100
commit178fbdbf4ce1e37f4db179a0de14ae19b01923d2 (patch)
treea98b07f30c0fa09935bfca109e968bd2218c16ff
parentcb81f0a8a194ceebaea880f9027635e6a27df69e (diff)
downloadRustAndDust-178fbdbf4ce1e37f4db179a0de14ae19b01923d2.zip
RustAndDust-178fbdbf4ce1e37f4db179a0de14ae19b01923d2.tar.gz
Game: Factory knows about regions and provide them
-rw-r--r--android/assets/data/hud.atlas15
-rw-r--r--android/assets/data/hud.pngbin98229 -> 93061 bytes
-rw-r--r--android/assets/data/ui.atlas9
-rw-r--r--android/assets/data/ui.pngbin133675 -> 133638 bytes
-rw-r--r--assets/hud/disabled.png (renamed from assets/ui/disabled.png)bin223 -> 223 bytes
-rw-r--r--core/src/ch/asynk/rustanddust/engine/HeadedPawn.java8
-rw-r--r--core/src/ch/asynk/rustanddust/engine/Pawn.java5
-rw-r--r--core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/Army.java20
-rw-r--r--core/src/ch/asynk/rustanddust/game/Hud.java10
-rw-r--r--core/src/ch/asynk/rustanddust/game/Unit.java10
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Factory.java47
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/ActionButtons.java13
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java21
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java17
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/StatisticsPanel.java19
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/UnitDock.java10
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map3Animations.java28
18 files changed, 140 insertions, 98 deletions
diff --git a/android/assets/data/hud.atlas b/android/assets/data/hud.atlas
index 2ee788a..08199ed 100644
--- a/android/assets/data/hud.atlas
+++ b/android/assets/data/hud.atlas
@@ -20,7 +20,7 @@ attack
index: -1
cancel
rotate: false
- xy: 180, 157
+ xy: 138, 107
size: 48, 47
orig: 48, 47
offset: 0, 0
@@ -32,6 +32,13 @@ defense
orig: 24, 24
offset: 0, 0
index: -1
+disabled
+ rotate: false
+ xy: 88, 78
+ size: 48, 48
+ orig: 48, 48
+ offset: 0, 0
+ index: -1
ge-flag
rotate: false
xy: 130, 206
@@ -41,21 +48,21 @@ ge-flag
index: -1
ok
rotate: false
- xy: 138, 107
+ xy: 188, 107
size: 48, 47
orig: 48, 47
offset: 0, 0
index: -1
promote
rotate: false
- xy: 88, 78
+ xy: 84, 28
size: 48, 48
orig: 48, 48
offset: 0, 0
index: -1
reinforcement
rotate: false
- xy: 84, 28
+ xy: 180, 156
size: 48, 48
orig: 48, 48
offset: 0, 0
diff --git a/android/assets/data/hud.png b/android/assets/data/hud.png
index 3bfb0b4..951b061 100644
--- a/android/assets/data/hud.png
+++ b/android/assets/data/hud.png
Binary files differ
diff --git a/android/assets/data/ui.atlas b/android/assets/data/ui.atlas
index 2271124..55a7be1 100644
--- a/android/assets/data/ui.atlas
+++ b/android/assets/data/ui.atlas
@@ -11,13 +11,6 @@ cancel
orig: 64, 63
offset: 0, 0
index: -1
-disabled
- rotate: false
- xy: 452, 41
- size: 48, 48
- orig: 48, 48
- offset: 0, 0
- index: -1
from
rotate: false
xy: 2, 2
@@ -55,7 +48,7 @@ to
index: -1
typewriter
rotate: false
- xy: 928, 106
+ xy: 452, 41
size: 48, 48
split: 23, 23, 23, 23
pad: 11, 11, 12, 12
diff --git a/android/assets/data/ui.png b/android/assets/data/ui.png
index 5aa721d..c8e0be6 100644
--- a/android/assets/data/ui.png
+++ b/android/assets/data/ui.png
Binary files differ
diff --git a/assets/ui/disabled.png b/assets/hud/disabled.png
index 70cc80b..70cc80b 100644
--- a/assets/ui/disabled.png
+++ b/assets/hud/disabled.png
Binary files differ
diff --git a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
index f60e38e..073f227 100644
--- a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java
@@ -3,7 +3,7 @@ package ch.asynk.rustanddust.engine;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-import com.badlogic.gdx.graphics.g2d.TextureRegion;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Vector3;
@@ -19,10 +19,10 @@ public abstract class HeadedPawn extends Pawn
this.orientation = Orientation.KEEP;
}
- public HeadedPawn(Faction faction, String pawn, String head, TextureAtlas pawns, TextureAtlas overlays)
+ public HeadedPawn(Faction faction, AtlasRegion body, AtlasRegion head, TextureAtlas overlays)
{
- super(faction, pawn, pawns, overlays);
- this.head = new Sprite(pawns.findRegion(head));
+ super(faction, body, overlays);
+ this.head = new Sprite(head);
this.orientation = Orientation.KEEP;
this.descr += " " + orientation;
}
diff --git a/core/src/ch/asynk/rustanddust/engine/Pawn.java b/core/src/ch/asynk/rustanddust/engine/Pawn.java
index 43de4f4..ce5fb58 100644
--- a/core/src/ch/asynk/rustanddust/engine/Pawn.java
+++ b/core/src/ch/asynk/rustanddust/engine/Pawn.java
@@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@@ -78,12 +79,12 @@ public abstract class Pawn implements Moveable, Disposable
this.attack = new Attack(this);
}
- public Pawn(Faction faction, String name, TextureAtlas pawns, TextureAtlas overlays)
+ public Pawn(Faction faction, AtlasRegion body, TextureAtlas overlays)
{
this();
this.faction = faction;
this.descr = descr;
- this.sprite = new Sprite(pawns.findRegion(name));
+ this.sprite = new Sprite(body);
this.overlays = new StackedImages(overlays);
}
diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
index 24eac18..e054acb 100644
--- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
+++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/PromoteAnimation.java
@@ -3,7 +3,7 @@ package ch.asynk.rustanddust.engine.gfx.animations;
import java.lang.Math;
import com.badlogic.gdx.audio.Sound;
-import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@@ -32,9 +32,9 @@ public class PromoteAnimation implements Animation, Drawable
private float volume;
private float elapsed;
- public static void init(TextureAtlas atlas, Sound usSnd, Sound geSnd)
+ public static void init(AtlasRegion r, Sound usSnd, Sound geSnd)
{
- region = atlas.findRegion("stars");
+ region = r;
usSound = usSnd;
geSound = geSnd;
}
diff --git a/core/src/ch/asynk/rustanddust/game/Army.java b/core/src/ch/asynk/rustanddust/game/Army.java
index 21cad9f..aaa4073 100644
--- a/core/src/ch/asynk/rustanddust/game/Army.java
+++ b/core/src/ch/asynk/rustanddust/game/Army.java
@@ -1,19 +1,27 @@
package ch.asynk.rustanddust.game;
import ch.asynk.rustanddust.engine.Faction;
+import ch.asynk.rustanddust.game.battles.Factory;
public enum Army implements Faction
{
- NONE("None"),
- GE("German"),
- US("US"),
- USSR("Soviet"),
- EN("English");
+ NONE("None", null),
+ GE("German", Factory.FLAG_GE),
+ US("US", Factory.FLAG_US),
+ USSR("Soviet", null),
+ EN("English", null);
private String s;
+ private String f;
- Army(String s) {
+ Army(String s, String f) {
this.s = s;
+ this.f = f;
+ }
+
+ public String flag()
+ {
+ return f;
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java
index a60d125..77b9f71 100644
--- a/core/src/ch/asynk/rustanddust/game/Hud.java
+++ b/core/src/ch/asynk/rustanddust/game/Hud.java
@@ -62,13 +62,13 @@ public class Hud implements Disposable, Animation
this.delayOn = false;
TextureAtlas hudAtlas = game.factory.hudAtlas;
- playerInfo = new PlayerInfo(ctrl, game.font, game.uiAtlas, hudAtlas);
- actionButtons = new ActionButtons(ctrl, game.uiAtlas, hudAtlas);
+ playerInfo = new PlayerInfo(game);
+ actionButtons = new ActionButtons(game);
actionButtons.hide();
msg = new Msg(game.font, game.ninePatch, 20f);
- okCancel = new OkCancel(game.font, game.ninePatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL));
- stats = new StatisticsPanel(game.font, game.uiAtlas, hudAtlas);
- engagement = new EngagementPanel(game.font, game.uiAtlas, hudAtlas);
+ 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);
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java
index 9ccb621..bbb60ef 100644
--- a/core/src/ch/asynk/rustanddust/game/Unit.java
+++ b/core/src/ch/asynk/rustanddust/game/Unit.java
@@ -1,7 +1,7 @@
package ch.asynk.rustanddust.game;
-import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import ch.asynk.rustanddust.engine.Pawn;
import ch.asynk.rustanddust.engine.Tile;
@@ -65,9 +65,9 @@ public class Unit extends HeadedPawn
private boolean hasMoved;
private boolean hasFired;
- protected Unit(Army army, String pawn, String head, TextureAtlas pawns, TextureAtlas overlays)
+ protected Unit(Army army, AtlasRegion body, AtlasRegion head, TextureAtlas overlays)
{
- super(army, pawn, head, pawns, overlays);
+ super(army, body, head, overlays);
hq = false;
ace = false;
@@ -90,9 +90,9 @@ public class Unit extends HeadedPawn
this.descr = id.toString() + (hq ? " HQ " : "") + (ace ? " Ace " : "") + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")";
}
- public Unit(Army army, UnitId id, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints, String unit, String head, TextureAtlas pawns, TextureAtlas overlays)
+ public Unit(Army army, UnitId id, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints, AtlasRegion body, AtlasRegion head, TextureAtlas overlays)
{
- this(army, unit, head, pawns, overlays);
+ this(army, body, head, overlays);
this.hq = hq;
this.ace = ace;
this.rng = range;
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
index ee8af91..020231f 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java
@@ -2,6 +2,7 @@ package ch.asynk.rustanddust.game.battles;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import ch.asynk.rustanddust.RustAndDust;
import ch.asynk.rustanddust.engine.Board;
@@ -17,6 +18,20 @@ import ch.asynk.rustanddust.game.battles.BattleTest;
public class Factory implements Board.TileBuilder, Disposable
{
+ public static final String FLAG_US = "us-flag";
+ public static final String FLAG_GE = "ge-flag";
+ public static final String HUD_TURNS = "turns";
+ public static final String HUD_STARS = "stars";
+ public static final String HUD_APS = "aps";
+ public static final String PNG_ATTACK = "attack";
+ public static final String PNG_DEFENSE = "defense";
+ 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 DISABLED = "disabled";
+ public static final String REINFORCEMENT = "reinforcement";
+ public static final String REINFORCEMENT_SELECTED = "reinforcement-selected";
+
public enum MapType
{
MAP_00,
@@ -48,10 +63,10 @@ public class Factory implements Board.TileBuilder, Disposable
{
if (assetsLoaded) return;
int i = game.config.graphics.i;
- this.hudAtlas = game.manager.get("data/hud.atlas", TextureAtlas.class);
- this.hexOverlaysAtlas = game.manager.get("data/hex-overlays.atlas", TextureAtlas.class);
- this.unitsAtlas = game.manager.get(String.format("data/units%d.atlas", i), TextureAtlas.class);
- this.unitOverlaysAtlas = game.manager.get(String.format("data/unit-overlays%d.atlas", i), TextureAtlas.class);
+ this.hudAtlas = game.manager.get(game.ATLAS_HUD, TextureAtlas.class);
+ this.hexOverlaysAtlas = game.manager.get(game.ATLAS_HEX_OVERLAYS, TextureAtlas.class);
+ this.unitsAtlas = game.manager.get(String.format(game.ATLAS_UNITS, i), TextureAtlas.class);
+ this.unitOverlaysAtlas = game.manager.get(String.format(game.ATLAS_UNIT_OVERLAYS, i), TextureAtlas.class);
this.assetsLoaded = true;
}
@@ -66,12 +81,22 @@ public class Factory implements Board.TileBuilder, Disposable
this.assetsLoaded = false;
}
+ public AtlasRegion getHudRegion(String s)
+ {
+ return hudAtlas.findRegion(s);
+ }
+
+ public AtlasRegion getFlag(Army army)
+ {
+ return hudAtlas.findRegion(army.flag());
+ }
+
public Map getMap(MapType t)
{
Map m = null;
switch(t) {
case MAP_00:
- m = new Map00(game, "data/map_00.png", "data/selected.png");
+ m = new Map00(game, game.PNG_MAP_00, game.PNG_SELECTED);
break;
}
@@ -140,10 +165,15 @@ public class Factory implements Board.TileBuilder, Disposable
private Unit buildUnit(Army army, UnitId id, UnitType ut, boolean hq, boolean ace, int a, int d, int cd, int m, String body)
{
- return new Unit(army, id, ut, hq, ace, a, d, cd, m, body, getHead(army, body), unitsAtlas, unitOverlaysAtlas);
+ return new Unit(army, id, ut, hq, ace, a, d, cd, m, getUnitRegion(body), getHead(army, body), unitOverlaysAtlas);
+ }
+
+ private AtlasRegion getUnitRegion(String s)
+ {
+ return unitsAtlas.findRegion(s);
}
- private String getHead(Army army, String body)
+ private AtlasRegion getHead(Army army, String body)
{
String head = null;
switch(game.config.graphics) {
@@ -154,8 +184,7 @@ public class Factory implements Board.TileBuilder, Disposable
head = body + "-head";
break;
}
- System.err.println(head);
- return head;
+ return getUnitRegion(head);
}
public Hex getNewTile(float x, float y, int col, int row, boolean offmap)
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;
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map3Animations.java b/core/src/ch/asynk/rustanddust/game/map/Map3Animations.java
index 2b3badf..b0080ce 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map3Animations.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map3Animations.java
@@ -36,26 +36,26 @@ public abstract class Map3Animations extends Map2Moves implements MoveToAnimatio
super(game, map, hex);
this.destroyAnimation = new DestroyAnimation();
- this.tankMoveSound = game.manager.get("sounds/tank_move.mp3", Sound.class);
- this.infantryMoveSound = game.manager.get("sounds/infantry_move.mp3", Sound.class);
+ this.tankMoveSound = game.manager.get(game.SND_TANK_MOVE, Sound.class);
+ this.infantryMoveSound = game.manager.get(game.SND_INF_MOVE, Sound.class);
DiceAnimation.init(
- game.manager.get("data/dice.png", Texture.class), 16, 9, game.manager.get("sounds/dice.mp3", Sound.class)
+ game.manager.get(game.PNG_DICE, Texture.class), 16, 9, game.manager.get(game.SND_DICE, Sound.class)
);
PromoteAnimation.init(
- game.manager.get("data/hud.atlas", TextureAtlas.class),
- game.manager.get("sounds/promote_us.mp3", Sound.class),
- game.manager.get("sounds/promote_ge.mp3", Sound.class)
+ game.factory.getHudRegion(game.factory.HUD_STARS),
+ game.manager.get(game.SND_PROMOTE_US, Sound.class),
+ game.manager.get(game.SND_PROMOTE_GE, Sound.class)
);
FireAnimation.init(
- game.manager.get("data/infantry_fire.png", Texture.class), 1, 8,
- game.manager.get("data/tank_fire.png", Texture.class), 1, 8,
- game.manager.get("data/explosions.png", Texture.class), 16, 8,
- game.manager.get("sounds/infantry_fire.mp3", Sound.class),
- game.manager.get("sounds/tank_fire.mp3", Sound.class),
- game.manager.get("sounds/tank_fire_short.mp3", Sound.class),
- game.manager.get("sounds/explosion.mp3", Sound.class),
- game.manager.get("sounds/explosion_short.mp3", Sound.class)
+ game.manager.get(game.PNG_INF_FIRE, Texture.class), 1, 8,
+ game.manager.get(game.PNG_TANK_FIRE, Texture.class), 1, 8,
+ game.manager.get(game.PNG_EXPLOSIONS, Texture.class), 16, 8,
+ game.manager.get(game.SND_INF_FIRE, Sound.class),
+ game.manager.get(game.SND_TANK_FIRE, Sound.class),
+ game.manager.get(game.SND_TANK_FIRE_SHORT, Sound.class),
+ game.manager.get(game.SND_EXPLOSION, Sound.class),
+ game.manager.get(game.SND_EXPLOSION_SHORT, Sound.class)
);
}