summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-17 10:13:05 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-17 10:13:05 +0200
commit7b5f3965cdd36dfc56f0d68357fc9ea1430f2712 (patch)
tree13613c8e322077d31f3dfcdbd1a5b34e48367a8b
parent92917aa0c7612911ae4ebbf005baf96a71e3e9b1 (diff)
downloadRustAndDust-7b5f3965cdd36dfc56f0d68357fc9ea1430f2712.zip
RustAndDust-7b5f3965cdd36dfc56f0d68357fc9ea1430f2712.tar.gz
Factory: has a TankOnTank ref
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/Factory.java12
3 files changed, 12 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 147d161..b409095 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -27,7 +27,7 @@ public class TankOnTank extends Game
Gdx.app.debug("TankOnTank", "create() [" + Gdx.graphics.getWidth() + ";" + Gdx.graphics.getHeight() + "]");
manager = new AssetManager();
- factory = new Factory();
+ factory = new Factory(this);
skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
config = new Config();
@@ -58,7 +58,7 @@ public class TankOnTank extends Game
public void onLoaded()
{
- factory.setAtlas(manager.get("data/assets.atlas", TextureAtlas.class));
+ factory.assetsLoaded();
}
// @Override
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index ad8c37f..8c7a840 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -40,7 +40,7 @@ public class Ctrl implements Disposable
this.players[0] = game.factory.getPlayer(Army.GE);
this.players[1] = game.factory.getPlayer(Army.US);
- this.map = game.factory.getMap(game, Factory.MapType.MAP_A);
+ this.map = game.factory.getMap(Factory.MapType.MAP_A);
game.factory.fakeSetup(map, players[0], players[1]);
player = (new java.util.Random()).nextInt(2);
diff --git a/core/src/ch/asynk/tankontank/game/Factory.java b/core/src/ch/asynk/tankontank/game/Factory.java
index cecfab6..5b60dc7 100644
--- a/core/src/ch/asynk/tankontank/game/Factory.java
+++ b/core/src/ch/asynk/tankontank/game/Factory.java
@@ -28,10 +28,16 @@ public class Factory implements Board.TileBuilder, Disposable
}
private TextureAtlas atlas;
+ private final TankOnTank game;
- public void setAtlas(TextureAtlas atlas)
+ public Factory(final TankOnTank game)
{
- this.atlas = atlas;
+ this.game = game;
+ }
+
+ public void assetsLoaded()
+ {
+ this.atlas = game.manager.get("data/assets.atlas", TextureAtlas.class);
}
@Override
@@ -57,7 +63,7 @@ public class Factory implements Board.TileBuilder, Disposable
return cfg;
}
- public Map getMap(final TankOnTank game, MapType t)
+ public Map getMap(MapType t)
{
Board.Config cfg = config();