diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-20 15:31:22 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-20 15:31:22 +0100 |
commit | c2e4fec0d0f32f5abbd609e5778fc1710732400f (patch) | |
tree | 047363b843e7954fbe99fc294600714e16f45286 /core/src/ch/asynk/rustanddust/game/battles | |
parent | d50992afc8ffaa06c024267ebc0958dc2083e33a (diff) | |
download | RustAndDust-c2e4fec0d0f32f5abbd609e5778fc1710732400f.zip RustAndDust-c2e4fec0d0f32f5abbd609e5778fc1710732400f.tar.gz |
Board,Map: each Map impelementation owns it's own Config
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/Factory.java | 23 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/MapA.java | 22 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/MapB.java | 22 |
3 files changed, 42 insertions, 25 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java index 4390663..2e128d3 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java @@ -79,34 +79,15 @@ public class Factory implements Board.TileBuilder, Disposable this.assetsLoaded = false; } - private Board.Config config() - { - Board.Config cfg = new Board.Config(); - cfg.cols = 10; - cfg.rows = 9; - cfg.x0 = 86; - cfg.y0 = 182; - cfg.w = 189; - cfg.dw = 94; - cfg.s = 110; - cfg.dh = 53.6f; - cfg.h = cfg.s + cfg.dh; - cfg.slope = (cfg.dh / (float) cfg.dw); - - return cfg; - } - public Map getMap(MapType t) { - Board.Config cfg = config(); - Map m = null; switch(t) { case MAP_A: - m = new MapA(game, config(), "data/map_a.png"); + m = new MapA(game, "data/map_a.png"); break; case MAP_B: - m = new MapB(game, config(), "data/map_b.png"); + m = new MapB(game, "data/map_b.png"); break; } diff --git a/core/src/ch/asynk/rustanddust/game/battles/MapA.java b/core/src/ch/asynk/rustanddust/game/battles/MapA.java index 491b370..f7d33c4 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/MapA.java +++ b/core/src/ch/asynk/rustanddust/game/battles/MapA.java @@ -8,9 +8,27 @@ import ch.asynk.rustanddust.game.Hex; public class MapA extends Map { - public MapA(final RustAndDust game, Board.Config cfg, String textureName) + public MapA(final RustAndDust game, String textureName) { - super(game, cfg, textureName); + super(game, textureName); + } + + @Override + protected Board.Config getConfig() + { + Board.Config cfg = new Board.Config(); + cfg.cols = 10; + cfg.rows = 9; + cfg.x0 = 86; + cfg.y0 = 182; + cfg.w = 189; + cfg.dw = 94; + cfg.s = 110; + cfg.dh = 53.6f; + cfg.h = cfg.s + cfg.dh; + cfg.slope = (cfg.dh / (float) cfg.dw); + + return cfg; } @Override diff --git a/core/src/ch/asynk/rustanddust/game/battles/MapB.java b/core/src/ch/asynk/rustanddust/game/battles/MapB.java index 8636481..2b8838c 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/MapB.java +++ b/core/src/ch/asynk/rustanddust/game/battles/MapB.java @@ -8,9 +8,27 @@ import ch.asynk.rustanddust.game.Hex; public class MapB extends Map { - public MapB(final RustAndDust game, Board.Config cfg, String textureName) + public MapB(final RustAndDust game, String textureName) { - super(game, cfg, textureName); + super(game, textureName); + } + + @Override + protected Board.Config getConfig() + { + Board.Config cfg = new Board.Config(); + cfg.cols = 10; + cfg.rows = 9; + cfg.x0 = 86; + cfg.y0 = 182; + cfg.w = 189; + cfg.dw = 94; + cfg.s = 110; + cfg.dh = 53.6f; + cfg.h = cfg.s + cfg.dh; + cfg.slope = (cfg.dh / (float) cfg.dw); + + return cfg; } @Override |