summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-23 17:12:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-23 17:12:11 +0200
commitca172c2ab35280a27a89ce1da1bfebca4923b849 (patch)
tree4d0fc463097cc4c859922dce9a5461f05f1d42cc /core/src/ch/asynk/tankontank/engine
parenta2fdafa229cadee934b11b492916bf2d8131eba5 (diff)
downloadRustAndDust-ca172c2ab35280a27a89ce1da1bfebca4923b849.zip
RustAndDust-ca172c2ab35280a27a89ce1da1bfebca4923b849.tar.gz
implement clear overlays in Board/Tile/StackImage
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java13
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java6
3 files changed, 25 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 3115c40..dc6ce63 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -181,6 +181,19 @@ public abstract class Board extends Image implements Disposable
debugShapes.setTransformMatrix(prevTransform);
}
+ public void clearOverlaysOn(int col, int row)
+ {
+ clearOverlaysOn(board[row][col]);
+ }
+
+ public void clearOverlaysOn(Tile tile)
+ {
+ if (tile.clearOverlays())
+ tilesToDraw.add(tile);
+ else
+ tilesToDraw.remove(tile);
+ }
+
public void enableOverlayOn(int col, int row, int i, boolean enable)
{
enableOverlayOn(board[row][col], i, enable);
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index 92b8dc4..d517b27 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -52,6 +52,12 @@ public abstract class Tile implements BasicDrawable
return (stack.size() != 0);
}
+ public boolean clearOverlays()
+ {
+ overlays.clear();
+ return occupied();
+ }
+
public boolean hasOverlayEnabled()
{
return overlays.isEnabled();
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
index 5eb5e55..70d30b8 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
@@ -17,6 +17,12 @@ public class StackedImages implements BasicDrawable
this.enabled = new boolean[sprites.size];
}
+ public void clear()
+ {
+ for (int i = 0; i < sprites.size; i++)
+ enabled[i] = false;
+ }
+
public void enable(int i, boolean enable)
{
enabled[i] = enable;