From 2c58bbf094d26f755eb43ee83fad0c17854224c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 30 Dec 2014 21:44:12 +0100 Subject: extract ui.atlas from hud.atlas --- android/assets/data/hud.atlas | 66 ++++----------------- android/assets/data/hud.png | Bin 106219 -> 62948 bytes android/assets/data/ui.atlas | 50 ++++++++++++++++ android/assets/data/ui.png | Bin 0 -> 37837 bytes assets/build.gradle | 12 ++++ assets/hud/cancel.png | Bin 5502 -> 0 bytes assets/hud/disabled.png | Bin 223 -> 0 bytes assets/hud/ok.png | Bin 5724 -> 0 bytes assets/hud/typewriter.9.png | Bin 4780 -> 0 bytes assets/hud/veteran-black.png | Bin 8980 -> 0 bytes assets/hud/veteran-white.png | Bin 9306 -> 0 bytes assets/ui/cancel.png | Bin 0 -> 5502 bytes assets/ui/disabled.png | Bin 0 -> 223 bytes assets/ui/ok.png | Bin 0 -> 5724 bytes assets/ui/typewriter.9.png | Bin 0 -> 4780 bytes assets/ui/veteran-black.png | Bin 0 -> 8980 bytes assets/ui/veteran-white.png | Bin 0 -> 9306 bytes core/src/ch/asynk/tankontank/TankOnTank.java | 2 + core/src/ch/asynk/tankontank/game/Hud.java | 19 +++--- .../asynk/tankontank/game/hud/ActionButtons.java | 10 ++-- .../ch/asynk/tankontank/game/hud/Engagement.java | 14 ++--- .../ch/asynk/tankontank/game/hud/PlayerInfo.java | 14 ++--- 22 files changed, 104 insertions(+), 83 deletions(-) create mode 100644 android/assets/data/ui.atlas create mode 100644 android/assets/data/ui.png delete mode 100644 assets/hud/cancel.png delete mode 100644 assets/hud/disabled.png delete mode 100644 assets/hud/ok.png delete mode 100644 assets/hud/typewriter.9.png delete mode 100644 assets/hud/veteran-black.png delete mode 100644 assets/hud/veteran-white.png create mode 100644 assets/ui/cancel.png create mode 100644 assets/ui/disabled.png create mode 100644 assets/ui/ok.png create mode 100644 assets/ui/typewriter.9.png create mode 100644 assets/ui/veteran-black.png create mode 100644 assets/ui/veteran-white.png diff --git a/android/assets/data/hud.atlas b/android/assets/data/hud.atlas index 85e1c2e..4db9648 100644 --- a/android/assets/data/hud.atlas +++ b/android/assets/data/hud.atlas @@ -1,120 +1,76 @@ hud.png -size: 512,512 +size: 256,256 format: RGBA8888 filter: Nearest,Nearest repeat: none aps rotate: false - xy: 370, 462 + xy: 2, 28 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 attack rotate: false - xy: 324, 358 + xy: 68, 2 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 -cancel - rotate: false - xy: 2, 19 - size: 48, 48 - orig: 48, 48 - offset: 0, 0 - index: -1 defense rotate: false - xy: 102, 43 + xy: 94, 2 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 -disabled - rotate: false - xy: 84, 69 - size: 48, 48 - orig: 48, 48 - offset: 0, 0 - index: -1 ge-flag rotate: false - xy: 2, 69 + xy: 2, 78 size: 80, 48 orig: 80, 48 offset: 0, 0 index: -1 -ok - rotate: false - xy: 52, 19 - size: 48, 48 - orig: 48, 48 - offset: 0, 0 - index: -1 promote rotate: false - xy: 242, 284 + xy: 130, 156 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 reinforcement rotate: false - xy: 370, 412 + xy: 84, 78 size: 48, 48 orig: 48, 48 offset: 0, 0 index: -1 reinforcement-selected rotate: false - xy: 242, 384 + xy: 2, 128 size: 126, 126 orig: 126, 126 offset: 0, 0 index: -1 stars rotate: false - xy: 2, 2 + xy: 2, 11 size: 64, 15 orig: 64, 15 offset: 0, 0 index: -1 turns rotate: false - xy: 420, 462 - size: 48, 48 - orig: 48, 48 - offset: 0, 0 - index: -1 -typewriter - rotate: false - xy: 134, 69 + xy: 52, 28 size: 48, 48 - split: 23, 23, 23, 23 - pad: 11, 11, 12, 12 orig: 48, 48 offset: 0, 0 index: -1 us-flag rotate: false - xy: 242, 334 + xy: 130, 206 size: 80, 48 orig: 80, 48 offset: 0, 0 index: -1 -veteran-black - rotate: false - xy: 2, 119 - size: 118, 391 - orig: 118, 391 - offset: 0, 0 - index: -1 -veteran-white - rotate: false - xy: 122, 119 - size: 118, 391 - orig: 118, 391 - offset: 0, 0 - index: -1 diff --git a/android/assets/data/hud.png b/android/assets/data/hud.png index 0d3ce28..04ee5be 100644 Binary files a/android/assets/data/hud.png and b/android/assets/data/hud.png differ diff --git a/android/assets/data/ui.atlas b/android/assets/data/ui.atlas new file mode 100644 index 0000000..905d26f --- /dev/null +++ b/android/assets/data/ui.atlas @@ -0,0 +1,50 @@ + +ui.png +size: 256,512 +format: RGBA8888 +filter: Nearest,Nearest +repeat: none +cancel + rotate: false + xy: 2, 52 + size: 48, 48 + orig: 48, 48 + offset: 0, 0 + index: -1 +disabled + rotate: false + xy: 2, 2 + size: 48, 48 + orig: 48, 48 + offset: 0, 0 + index: -1 +ok + rotate: false + xy: 52, 52 + size: 48, 48 + orig: 48, 48 + offset: 0, 0 + index: -1 +typewriter + rotate: false + xy: 52, 2 + size: 48, 48 + split: 23, 23, 23, 23 + pad: 11, 11, 12, 12 + orig: 48, 48 + offset: 0, 0 + index: -1 +veteran-black + rotate: false + xy: 2, 102 + size: 118, 391 + orig: 118, 391 + offset: 0, 0 + index: -1 +veteran-white + rotate: false + xy: 122, 102 + size: 118, 391 + orig: 118, 391 + offset: 0, 0 + index: -1 diff --git a/android/assets/data/ui.png b/android/assets/data/ui.png new file mode 100644 index 0000000..af01d0e Binary files /dev/null and b/android/assets/data/ui.png differ diff --git a/assets/build.gradle b/assets/build.gradle index 808ae80..674c38a 100644 --- a/assets/build.gradle +++ b/assets/build.gradle @@ -30,6 +30,18 @@ task copySounds(type: Copy) { into '../android/assets/sounds' } +task packUi(type: JavaExec) { + main = 'com.badlogic.gdx.tools.texturepacker.TexturePacker' + classpath = configurations.texturePacker + args = ['../assets/ui', '../android/assets/data', 'ui'] +} + +task packMenu(type: JavaExec) { + main = 'com.badlogic.gdx.tools.texturepacker.TexturePacker' + classpath = configurations.texturePacker + args = ['../assets/menu', '../android/assets/data', 'menu'] +} + task packHud(type: JavaExec) { main = 'com.badlogic.gdx.tools.texturepacker.TexturePacker' classpath = configurations.texturePacker diff --git a/assets/hud/cancel.png b/assets/hud/cancel.png deleted file mode 100644 index a5b3d99..0000000 Binary files a/assets/hud/cancel.png and /dev/null differ diff --git a/assets/hud/disabled.png b/assets/hud/disabled.png deleted file mode 100644 index 70cc80b..0000000 Binary files a/assets/hud/disabled.png and /dev/null differ diff --git a/assets/hud/ok.png b/assets/hud/ok.png deleted file mode 100644 index fa8cbf6..0000000 Binary files a/assets/hud/ok.png and /dev/null differ diff --git a/assets/hud/typewriter.9.png b/assets/hud/typewriter.9.png deleted file mode 100644 index a2fbc8c..0000000 Binary files a/assets/hud/typewriter.9.png and /dev/null differ diff --git a/assets/hud/veteran-black.png b/assets/hud/veteran-black.png deleted file mode 100644 index ea5fcbe..0000000 Binary files a/assets/hud/veteran-black.png and /dev/null differ diff --git a/assets/hud/veteran-white.png b/assets/hud/veteran-white.png deleted file mode 100644 index daa70d9..0000000 Binary files a/assets/hud/veteran-white.png and /dev/null differ diff --git a/assets/ui/cancel.png b/assets/ui/cancel.png new file mode 100644 index 0000000..a5b3d99 Binary files /dev/null and b/assets/ui/cancel.png differ diff --git a/assets/ui/disabled.png b/assets/ui/disabled.png new file mode 100644 index 0000000..70cc80b Binary files /dev/null and b/assets/ui/disabled.png differ diff --git a/assets/ui/ok.png b/assets/ui/ok.png new file mode 100644 index 0000000..fa8cbf6 Binary files /dev/null and b/assets/ui/ok.png differ diff --git a/assets/ui/typewriter.9.png b/assets/ui/typewriter.9.png new file mode 100644 index 0000000..a2fbc8c Binary files /dev/null and b/assets/ui/typewriter.9.png differ diff --git a/assets/ui/veteran-black.png b/assets/ui/veteran-black.png new file mode 100644 index 0000000..ea5fcbe Binary files /dev/null and b/assets/ui/veteran-black.png differ diff --git a/assets/ui/veteran-white.png b/assets/ui/veteran-white.png new file mode 100644 index 0000000..daa70d9 Binary files /dev/null and b/assets/ui/veteran-white.png differ 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 -- cgit v1.1-2-g2b99