diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-18 11:10:21 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-18 11:10:21 +0100 |
commit | cb81f0a8a194ceebaea880f9027635e6a27df69e (patch) | |
tree | a64e55aaa5f45d8329737af6633a6d3fe9f3a3ff /core/src/ch/asynk/rustanddust/menu | |
parent | 75ff89304eaf9052ab889bb7ec81c96de4fa7908 (diff) | |
download | RustAndDust-cb81f0a8a194ceebaea880f9027635e6a27df69e.zip RustAndDust-cb81f0a8a194ceebaea880f9027635e6a27df69e.tar.gz |
UI: merge menu and ui assets, AtlasRegion are known and provided by RustAndDust
Diffstat (limited to 'core/src/ch/asynk/rustanddust/menu')
5 files changed, 29 insertions, 39 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MainMenu.java b/core/src/ch/asynk/rustanddust/menu/MainMenu.java index ff65d50..620205a 100644 --- a/core/src/ch/asynk/rustanddust/menu/MainMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/MainMenu.java @@ -1,9 +1,8 @@ package ch.asynk.rustanddust.menu; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.ui.Menu; public class MainMenu extends Menu @@ -24,9 +23,9 @@ public class MainMenu extends Menu public int last() { return NONE.i; } }; - public MainMenu(BitmapFont font, TextureAtlas atlas) + public MainMenu(RustAndDust game) { - super(Items.NONE, font, atlas.createPatch("typewriter")); + super(Items.NONE, game.font, game.ninePatch); label(Items.PLAY).write("Play"); label(Items.TUTORIALS).write("Tutorials"); diff --git a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java index e2b3b1e..4499405 100644 --- a/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/OptionsMenu.java @@ -3,7 +3,6 @@ package ch.asynk.rustanddust.menu; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.GlyphLayout; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.rustanddust.ui.Label; import ch.asynk.rustanddust.ui.Bg; @@ -44,14 +43,14 @@ public class OptionsMenu extends Patch protected Bg okBtn; protected Bg cancelBtn; - public OptionsMenu(RustAndDust game, BitmapFont font, TextureAtlas atlas) + public OptionsMenu(RustAndDust game) { - super(atlas.createPatch("typewriter")); + super(game.ninePatch); this.game = game; - this.font = font; - this.okCancel = new OkCancel(font, atlas); - this.okBtn = new Bg(atlas.findRegion("ok")); - this.cancelBtn = new Bg(atlas.findRegion("cancel")); + this.font = game.font; + this.okCancel = new OkCancel(font, game.ninePatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL)); + this.okBtn = new Bg(game.getUiRegion(game.UI_OK)); + this.cancelBtn = new Bg(game.getUiRegion(game.UI_CANCEL)); this.title = new Label(font); this.title.write("- Options"); this.fxVolume = new Label(font); diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java index cbf182d..866a647 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -1,8 +1,6 @@ package ch.asynk.rustanddust.menu; import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.rustanddust.ui.Label; import ch.asynk.rustanddust.ui.Bg; @@ -17,7 +15,6 @@ public class PlayMenu extends Patch public static int VSPACING = 30; private final RustAndDust game; - private final BitmapFont font; private Label title; private Label gameMode; @@ -32,22 +29,21 @@ public class PlayMenu extends Patch public boolean launch; - public PlayMenu(RustAndDust game, BitmapFont font, TextureAtlas atlas) + public PlayMenu(RustAndDust game) { - super(atlas.createPatch("typewriter")); + super(game.ninePatch); this.game = game; - this.font = font; - this.title = new Label(font); + this.title = new Label(game.font); this.title.write("- Play"); - this.gameMode = new Label(font); + this.gameMode = new Label(game.font); this.gameMode.write("Game mode : "); - this.gameModeValue = new Label(font); - this.okBtn = new Bg(atlas.findRegion("ok")); - this.cancelBtn = new Bg(atlas.findRegion("cancel")); - this.battle = new Label(font); + this.gameModeValue = new Label(game.font); + this.okBtn = new Bg(game.getUiRegion(game.UI_OK)); + this.cancelBtn = new Bg(game.getUiRegion(game.UI_CANCEL)); + this.battle = new Label(game.font); this.battle.write("Scenario : "); - this.battleValue = new Label(font); - this.okCancel = new OkCancel(font, atlas); + this.battleValue = new Label(game.font); + this.okCancel = new OkCancel(game.font, game.ninePatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL)); if (game.config.battle == null) { battleIdx = 0; diff --git a/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java b/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java index 7140e48..cb1fcef 100644 --- a/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/ScenariosMenu.java @@ -31,13 +31,13 @@ public class ScenariosMenu extends Patch public boolean launch; - public ScenariosMenu(RustAndDust game, BitmapFont font, TextureAtlas atlas) + public ScenariosMenu(RustAndDust game) { - super(atlas.createPatch("typewriter")); + super(game.ninePatch); this.game = game; - this.font = font; - this.okBtn = new Bg(atlas.findRegion("ok")); - this.cancelBtn = new Bg(atlas.findRegion("cancel")); + this.font = game.font; + this.okBtn = new Bg(game.getUiRegion(game.UI_OK)); + this.cancelBtn = new Bg(game.getUiRegion(game.UI_CANCEL)); this.title = new Label(font); this.title.write("- Scenarios"); this.battleLabels = new Label[game.factory.battles.length]; diff --git a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java index 53dd29f..87e2765 100644 --- a/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/TutorialsMenu.java @@ -1,8 +1,6 @@ package ch.asynk.rustanddust.menu; import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.rustanddust.ui.Label; import ch.asynk.rustanddust.ui.Bg; @@ -15,21 +13,19 @@ public class TutorialsMenu extends Patch public static int TITLE_PADDING = 30; private final RustAndDust game; - private final BitmapFont font; private Label title; private Label msg; protected Bg okBtn; - public TutorialsMenu(RustAndDust game, BitmapFont font, TextureAtlas atlas) + public TutorialsMenu(RustAndDust game) { - super(atlas.createPatch("typewriter")); + super(game.ninePatch); this.game = game; - this.font = font; - this.okBtn = new Bg(atlas.findRegion("ok")); - this.title = new Label(font); + this.okBtn = new Bg(game.getUiRegion(game.UI_OK)); + this.title = new Label(game.font); this.title.write("- Tutorials"); - this.msg = new Label(font); + this.msg = new Label(game.font); this.msg.write("Not implemented yet."); this.visible = false; |