summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/Board.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/Map.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Factory.java23
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/MapA.java22
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/MapB.java22
5 files changed, 48 insertions, 29 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java
index e4aba6d..fb77dd8 100644
--- a/core/src/ch/asynk/rustanddust/engine/Board.java
+++ b/core/src/ch/asynk/rustanddust/engine/Board.java
@@ -65,6 +65,8 @@ public abstract class Board implements Disposable, Animation
protected SelectedTile selectedTile;
+ abstract protected Config getConfig();
+
protected Board(int cols, int rows)
{
// add a frame of OFFMAP Tiles
@@ -74,10 +76,10 @@ public abstract class Board implements Disposable, Animation
initSides();
}
- public Board(TileBuilder tileBuilder, Config cfg, Texture boardTexture, SelectedTile selectedTile)
+ public Board(TileBuilder tileBuilder, Texture boardTexture, SelectedTile selectedTile)
{
board = new Sprite(boardTexture);
- this.cfg = cfg;
+ this.cfg = getConfig();
// add a frame of OFFMAP Tiles
this.cols = (cfg.cols + 2);
this.rows = (cfg.rows + 2);
diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java
index dedbf23..e0134cb 100644
--- a/core/src/ch/asynk/rustanddust/game/Map.java
+++ b/core/src/ch/asynk/rustanddust/game/Map.java
@@ -59,9 +59,9 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
protected abstract void setup();
- public Map(final RustAndDust game, Board.Config cfg, String textureName)
+ public Map(final RustAndDust game, String textureName)
{
- super(game.factory, cfg, game.manager.get(textureName, Texture.class),
+ super(game.factory, game.manager.get(textureName, Texture.class),
new SelectedTile(game.manager.get("data/hex.png", Texture.class), new float[] {.2f, .1f, .1f, .1f, .2f, .1f} ));
this.ctrl = game.ctrl;
this.destroy = new DestroyAnimation();
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