summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-02 11:13:57 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-02 11:13:57 +0100
commitd07be94ba960a71174fa178879396fde491b7f7a (patch)
tree7c8e935d3a4fcfa5db2581e18d13e05c8a86fc0c /core
parentc317a3c3851dc2038233b2503b2a455c6690b197 (diff)
downloadRustAndDust-d07be94ba960a71174fa178879396fde491b7f7a.zip
RustAndDust-d07be94ba960a71174fa178879396fde491b7f7a.tar.gz
TankOnTank: correctly load/unload maps
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 52c16a1..20f600d 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -83,10 +83,10 @@ public class TankOnTank extends Game
public void loadGameAssets()
{
- debug("TankOnTank", " load assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
- // TODO load only needed map
- manager.load("data/map_a.png", Texture.class);
- manager.load("data/map_b.png", Texture.class);
+ if (config.battle.getMapType() == Factory.MapType.MAP_A)
+ manager.load("data/map_a.png", Texture.class);
+ if (config.battle.getMapType() == Factory.MapType.MAP_B)
+ manager.load("data/map_b.png", Texture.class);
manager.load("data/hex.png", Texture.class);
manager.load("data/hud.atlas", TextureAtlas.class);
manager.load("data/units.atlas", TextureAtlas.class);
@@ -104,14 +104,15 @@ public class TankOnTank extends Game
manager.load("sounds/explosion.mp3", Sound.class);
manager.load("sounds/explosion_short.mp3", Sound.class);
manager.load("sounds/promote.mp3", Sound.class);
+ debug("TankOnTank", " assets loaded : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
}
private void unloadGameAssets()
{
- debug("TankOnTank", "unload assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
- // TODO load only needed map
- manager.unload("data/map_a.png");
- manager.unload("data/map_b.png");
+ if (config.battle.getMapType() == Factory.MapType.MAP_A)
+ manager.unload("data/map_a.png");
+ if (config.battle.getMapType() == Factory.MapType.MAP_B)
+ manager.unload("data/map_b.png");
manager.unload("data/hex.png");
manager.unload("data/hud.atlas");
manager.unload("data/units.atlas");
@@ -129,6 +130,7 @@ public class TankOnTank extends Game
manager.unload("sounds/explosion.mp3");
manager.unload("sounds/explosion_short.mp3");
manager.unload("sounds/promote.mp3");
+ debug("TankOnTank", " assets unloaded : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
}
private void loadUiAssets()
@@ -144,7 +146,6 @@ public class TankOnTank extends Game
{
fontB.dispose();
fontW.dispose();
- uiAtlas.dispose();
manager.unload("data/ui.atlas");
}
@@ -158,7 +159,6 @@ public class TankOnTank extends Game
private void unloadMenuAssets()
{
- menuAtlas.dispose();
manager.unload("data/map_a.png");
manager.unload("data/menu.atlas");
}
@@ -196,6 +196,8 @@ public class TankOnTank extends Game
break;
}
debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
+ manager.clear();
+ manager.dispose();
}
// @Override