summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-30 21:44:12 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-30 21:44:12 +0100
commit2c58bbf094d26f755eb43ee83fad0c17854224c0 (patch)
tree9ba8999f146a870399ae7ef01a6682ccbe93be8f /core/src
parentda40130331b292b6b4a143959fe111a9312d8f9d (diff)
downloadRustAndDust-2c58bbf094d26f755eb43ee83fad0c17854224c0.zip
RustAndDust-2c58bbf094d26f755eb43ee83fad0c17854224c0.tar.gz
extract ui.atlas from hud.atlas
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java19
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/ActionButtons.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Engagement.java14
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java14
5 files changed, 31 insertions, 28 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index d1a3fb8..2e081fb 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -48,6 +48,7 @@ public class TankOnTank extends Game
manager.load("data/map_a.png", Texture.class);
manager.load("data/map_b.png", Texture.class);
manager.load("data/hex.png", Texture.class);
+ manager.load("data/ui.atlas", TextureAtlas.class);
manager.load("data/hud.atlas", TextureAtlas.class);
manager.load("data/units.atlas", TextureAtlas.class);
manager.load("data/unit-overlays.atlas", TextureAtlas.class);
@@ -73,6 +74,7 @@ public class TankOnTank extends Game
manager.unload("data/map_a.png");
manager.unload("data/map_b.png");
manager.unload("data/hex.png");
+ manager.unload("data/ui.atlas");
manager.unload("data/hud.atlas");
manager.unload("data/units.atlas");
manager.unload("data/unit-overlays.atlas");
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 6b7b8a6..c72ae91 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -50,16 +50,17 @@ public class Hud implements Disposable, Animation
this.game = game;
this.ctrl = ctrl;
- TextureAtlas atlas = game.factory.hudAtlas;
- fontB = new BitmapFont(Gdx.files.internal("skin/veteran.fnt"), atlas.findRegion("veteran-black"));
- fontW = new BitmapFont(Gdx.files.internal("skin/veteran.fnt"), atlas.findRegion("veteran-white"));
- playerInfo = new PlayerInfo(ctrl, fontW, atlas);
- actionButtons = new ActionButtons(ctrl, atlas);
+ TextureAtlas hudAtlas = game.factory.hudAtlas;
+ TextureAtlas uiAtlas = game.manager.get("data/ui.atlas", TextureAtlas.class);
+ fontB = new BitmapFont(Gdx.files.internal("skin/veteran.fnt"), uiAtlas.findRegion("veteran-black"));
+ fontW = new BitmapFont(Gdx.files.internal("skin/veteran.fnt"), uiAtlas.findRegion("veteran-white"));
+ playerInfo = new PlayerInfo(ctrl, fontW, uiAtlas, hudAtlas);
+ actionButtons = new ActionButtons(ctrl, uiAtlas, hudAtlas);
actionButtons.hide();
- msg = new Msg(fontB, atlas);
- okCancel = new OkCancel(fontB, atlas);
- stats = new Statistics(fontB, atlas);
- engagement = new Engagement(fontB, atlas);
+ msg = new Msg(fontB, uiAtlas);
+ okCancel = new OkCancel(fontB, uiAtlas);
+ stats = new Statistics(fontB, uiAtlas);
+ engagement = new Engagement(fontB, uiAtlas, hudAtlas);
}
@Override
diff --git a/core/src/ch/asynk/tankontank/game/hud/ActionButtons.java b/core/src/ch/asynk/tankontank/game/hud/ActionButtons.java
index ff9034e..17402f0 100644
--- a/core/src/ch/asynk/tankontank/game/hud/ActionButtons.java
+++ b/core/src/ch/asynk/tankontank/game/hud/ActionButtons.java
@@ -40,9 +40,9 @@ public class ActionButtons extends Widget
private StateType states [];
private Position position;
- public ActionButtons(Ctrl ctrl, TextureAtlas atlas)
+ public ActionButtons(Ctrl ctrl, TextureAtlas uiAtlas, TextureAtlas hudAtlas)
{
- this.bg = new Sprite(atlas.findRegion("disabled"));
+ this.bg = new Sprite(uiAtlas.findRegion("disabled"));
this.ctrl = ctrl;
this.visible = false;
this.position = Position.BOTTOM_RIGHT;
@@ -50,9 +50,9 @@ public class ActionButtons extends Widget
this.buttons = new Bg[Buttons.LAST.i];
- this.buttons[Buttons.DONE.i] = new Bg(atlas.findRegion("ok"));
- this.buttons[Buttons.ABORT.i] = new Bg(atlas.findRegion("cancel"));
- this.buttons[Buttons.PROMOTE.i] = new Bg(atlas.findRegion("promote"));
+ this.buttons[Buttons.DONE.i] = new Bg(uiAtlas.findRegion("ok"));
+ this.buttons[Buttons.ABORT.i] = new Bg(uiAtlas.findRegion("cancel"));
+ this.buttons[Buttons.PROMOTE.i] = new Bg(hudAtlas.findRegion("promote"));
this.states = new StateType[Buttons.LAST.i];
this.states[Buttons.DONE.i] = StateType.DONE;
diff --git a/core/src/ch/asynk/tankontank/game/hud/Engagement.java b/core/src/ch/asynk/tankontank/game/hud/Engagement.java
index 805b7d6..ffbfa65 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Engagement.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Engagement.java
@@ -44,18 +44,18 @@ public class Engagement extends Patch implements Animation
private DiceAnimation d3Animation;
private DiceAnimation d4Animation;
- public Engagement(BitmapFont font, TextureAtlas atlas)
+ public Engagement(BitmapFont font, TextureAtlas uiAtlas, TextureAtlas hudAtlas)
{
- super(atlas.createPatch("typewriter"));
- usFlag = new Sprite(atlas.findRegion("us-flag"));
- geFlag = new Sprite(atlas.findRegion("ge-flag"));
- attackImg = new Sprite(atlas.findRegion("attack"));
- defenseImg = new Sprite(atlas.findRegion("defense"));
+ super(uiAtlas.createPatch("typewriter"));
+ usFlag = new Sprite(hudAtlas.findRegion("us-flag"));
+ geFlag = new Sprite(hudAtlas.findRegion("ge-flag"));
+ attackImg = new Sprite(hudAtlas.findRegion("attack"));
+ defenseImg = new Sprite(hudAtlas.findRegion("defense"));
this.attack = new Label(font);
this.defense = new Label(font);
this.attackR = new Label(font);
this.defenseR = new Label(font);
- this.okBtn = new Bg(atlas.findRegion("ok"));
+ this.okBtn = new Bg(uiAtlas.findRegion("ok"));
this.visible = false;
this.d1Animation = new DiceAnimation();
this.d2Animation = new DiceAnimation();
diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
index 6125517..24f07b8 100644
--- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
+++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
@@ -37,16 +37,16 @@ public class PlayerInfo implements Disposable, Drawable, Animation
public UnitDock unitDock;
private Position position;
- public PlayerInfo(Ctrl ctrl, BitmapFont font, TextureAtlas atlas)
+ public PlayerInfo(Ctrl ctrl, BitmapFont font, TextureAtlas uiAtlas, TextureAtlas hudAtlas)
{
this.ctrl = ctrl;
this.position = Position.MIDDLE_CENTER;
- usFlag = new Sprite(atlas.findRegion("us-flag"));
- geFlag = new Sprite(atlas.findRegion("ge-flag"));
- turns = new LabelImage(atlas.findRegion("turns"), font, 5f);
- aps = new LabelImage(atlas.findRegion("aps"), font, 5f);
- reinforcement = new LabelImage(atlas.findRegion("reinforcement"), font, 5f);
- unitDock = new UnitDock(ctrl, atlas.findRegion("disabled"), atlas.findRegion("reinforcement-selected"), 10f);
+ usFlag = new Sprite(hudAtlas.findRegion("us-flag"));
+ geFlag = new Sprite(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);
}
@Override