summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-16 15:40:09 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-16 15:40:09 +0200
commit125708799076a89dcf4ed94326128ec787ec7ec7 (patch)
treee9a49d5998c7cebfada615aabd133a5e56b797b0
parentf12da226448e00683286f0a449d4271165377c60 (diff)
downloadRustAndDust-125708799076a89dcf4ed94326128ec787ec7ec7.zip
RustAndDust-125708799076a89dcf4ed94326128ec787ec7ec7.tar.gz
TankOnTank has a factory
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java9
-rw-r--r--core/src/ch/asynk/tankontank/screens/LoadScreen.java1
2 files changed, 9 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 0dbe669..6d404a8 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -8,10 +8,12 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import ch.asynk.tankontank.screens.LoadScreen;
+import ch.asynk.tankontank.game.Factory;
public class TankOnTank extends Game
{
public AssetManager manager;
+ public Factory factory;
public Skin skin;
@Override
@@ -21,10 +23,10 @@ public class TankOnTank extends Game
Gdx.app.debug("TankOnTank", "create() [" + Gdx.graphics.getWidth() + ";" + Gdx.graphics.getHeight() + "]");
manager = new AssetManager();
+ factory = new Factory();
skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
this.setScreen(new LoadScreen(this));
-
}
public void loadAssets()
@@ -49,6 +51,10 @@ public class TankOnTank extends Game
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
}
+ public void onLoaded()
+ {
+ factory.setAtlas(manager.get("data/assets.atlas", TextureAtlas.class));
+ }
// @Override
// public void render ()
@@ -69,6 +75,7 @@ public class TankOnTank extends Game
public void dispose()
{
Gdx.app.debug("TankOnTank", "dispose()");
+ factory.dispose();
getScreen().dispose();
}
diff --git a/core/src/ch/asynk/tankontank/screens/LoadScreen.java b/core/src/ch/asynk/tankontank/screens/LoadScreen.java
index ac607e9..a9419be 100644
--- a/core/src/ch/asynk/tankontank/screens/LoadScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/LoadScreen.java
@@ -48,6 +48,7 @@ public class LoadScreen implements Screen
delay += delta;
if (delay >= 0.2f) {
Gdx.app.debug("LoadScreen", "assets loaded : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
+ game.onLoaded();
game.setScreen(new GameScreen(game));
dispose();
}