summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-29 23:44:20 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-29 23:44:20 +0200
commit7dfd8c43375e87b1ca14242ed83b8970819e51fb (patch)
tree214576c3c2f5ececce8bd637e3ee185d9fc2b4bc /core
parent56ac560950033775345ea83dfa65aeb71ed4f92f (diff)
downloadRustAndDust-7dfd8c43375e87b1ca14242ed83b8970819e51fb.zip
RustAndDust-7dfd8c43375e87b1ca14242ed83b8970819e51fb.tar.gz
Board is not an Image anymore, but has an Image
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index f64e294..440f38b 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -24,7 +24,7 @@ import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.engine.gfx.animations.AnimationSequence;
import ch.asynk.tankontank.engine.gfx.animations.RunnableAnimation;
-public abstract class Board extends Image implements Disposable
+public abstract class Board implements Disposable
{
public interface TileBuilder
{
@@ -136,6 +136,7 @@ public abstract class Board extends Image implements Disposable
protected Config cfg;
private Tile[] tiles;
private SearchBoard searchBoard;
+ private Image image;
boolean transform;
private Matrix4 prevTransform;
@@ -153,7 +154,7 @@ public abstract class Board extends Image implements Disposable
public Board(TileBuilder tileBuilder, Config cfg, Texture texture)
{
- super(texture);
+ image = new Image(texture);
this.cfg = cfg;
this.tiles = new Tile[cfg.cols * cfg.rows];
searchBoard = new SearchBoard(this, cfg.cols, cfg.rows);
@@ -174,6 +175,12 @@ public abstract class Board extends Image implements Disposable
}
}
+ @Override
+ public void dispose()
+ {
+ image.dispose();
+ }
+
public Tile getTile(int col, int row)
{
int idx = ((col - ((row + 1) / 2))) + (row * cfg.cols);
@@ -202,10 +209,19 @@ public abstract class Board extends Image implements Disposable
}
}
- @Override
+ public float getWidth()
+ {
+ return image.getWidth();
+ }
+
+ public float getHeight()
+ {
+ return image.getHeight();
+ }
+
public void setPosition(float x, float y)
{
- super.setPosition(x, y);
+ image.setPosition(x, y);
if ((x != 0.0f) || (y != 0.0f)) {
transform = true;
prevTransform = new Matrix4();
@@ -262,10 +278,9 @@ public abstract class Board extends Image implements Disposable
nextAnimations.clear();
}
- @Override
public void draw(Batch batch)
{
- super.draw(batch);
+ image.draw(batch);
if (transform) {
prevTransform.set(batch.getTransformMatrix());
@@ -286,7 +301,6 @@ public abstract class Board extends Image implements Disposable
batch.setTransformMatrix(prevTransform);
}
- @Override
public void drawDebug(ShapeRenderer debugShapes)
{
stats();