summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java4
-rw-r--r--core/src/ch/asynk/tankontank/screens/LoadScreen.java3
-rw-r--r--core/src/ch/asynk/tankontank/screens/OptionsScreen.java2
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();
}
});