diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-30 21:48:26 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-30 21:48:26 +0100 |
commit | 30a62fe41ebbdd37c0aa91d6ef5223ac29276ca4 (patch) | |
tree | 02ad05a09f49561f17f54f41289d886af2ee3783 | |
parent | 9d5146d953453abda8cbbe35d4a42ea2ce198d90 (diff) | |
download | RustAndDust-30a62fe41ebbdd37c0aa91d6ef5223ac29276ca4.zip RustAndDust-30a62fe41ebbdd37c0aa91d6ef5223ac29276ca4.tar.gz |
TankOnTank: does the screen switching
4 files changed, 12 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java index 2e081fb..0d28391 100644 --- a/core/src/ch/asynk/tankontank/TankOnTank.java +++ b/core/src/ch/asynk/tankontank/TankOnTank.java @@ -8,6 +8,8 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import ch.asynk.tankontank.screens.LoadScreen; +import ch.asynk.tankontank.screens.OptionsScreen; +import ch.asynk.tankontank.screens.GameScreen; import ch.asynk.tankontank.game.Ctrl; import ch.asynk.tankontank.game.Config; import ch.asynk.tankontank.game.battles.Factory; @@ -94,9 +96,15 @@ public class TankOnTank extends Game debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() ); } - public void onLoaded() + public void switchToOptions() { factory.assetsLoaded(); + setScreen(new OptionsScreen(this)); + } + + public void switchToGame() + { + setScreen(new GameScreen(this)); } // @Override diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 8d73df9..0d34d20 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -16,8 +16,6 @@ import ch.asynk.tankontank.game.states.StateReinforcement; import ch.asynk.tankontank.game.states.StateDeployment; import ch.asynk.tankontank.game.states.StateEscape; -import ch.asynk.tankontank.screens.OptionsScreen; - public class Ctrl implements Disposable { private final TankOnTank game; @@ -306,7 +304,7 @@ public class Ctrl implements Disposable public void endGame() { - game.setScreen(new OptionsScreen(game)); + game.switchToOptions(); } public void endPlayerTurn(boolean abort) diff --git a/core/src/ch/asynk/tankontank/screens/LoadScreen.java b/core/src/ch/asynk/tankontank/screens/LoadScreen.java index 8aea946..1b4b401 100644 --- a/core/src/ch/asynk/tankontank/screens/LoadScreen.java +++ b/core/src/ch/asynk/tankontank/screens/LoadScreen.java @@ -139,8 +139,7 @@ public class LoadScreen implements Screen if (assetsLoaded) return; assetsLoaded = true; TankOnTank.debug("LoadScreen", "assets ready : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); - game.onLoaded(); - game.setScreen(new OptionsScreen(game)); + game.switchToOptions(); dispose(); } } diff --git a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java index 01a33a7..371cb64 100644 --- a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java +++ b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java @@ -121,7 +121,7 @@ public class OptionsScreen implements Screen } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { apply(); - game.setScreen(new GameScreen(game)); + game.switchToGame(); } }); |