summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-12 12:12:16 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-12 12:12:16 +0200
commit69a3e9bbb3d1b39118a595fae4af5d19b1048f12 (patch)
tree90644d2aafc8f247d52664100e15eda3f2aa38da
parent3afc38971c4d7cbbea48128c930f00d5734a529f (diff)
downloadRustAndDust-69a3e9bbb3d1b39118a595fae4af5d19b1048f12.zip
RustAndDust-69a3e9bbb3d1b39118a595fae4af5d19b1048f12.tar.gz
StackedImage,Tile,Map: enable rotation on a specific overlay
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java9
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java8
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java5
3 files changed, 22 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index e5bd302..17632ff 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -470,6 +470,15 @@ public abstract class Board implements Disposable
tilesToDraw.remove(tile);
}
+ public void enableOverlayOn(GridPoint2 coords, int i, boolean enable, Orientation o)
+ {
+ Tile tile = getTile(coords);
+ if(tile.enableOverlay(i, enable, o.r()))
+ tilesToDraw.add(tile);
+ else
+ tilesToDraw.remove(tile);
+ }
+
public Pawn getTopPawnAt(GridPoint2 coords)
{
return getTile(coords).getTopPawn();
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index b47548c..fdcc61e 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -131,6 +131,14 @@ public abstract class Tile implements Drawable, Disposable
return mustBeDrawn();
}
+ public boolean enableOverlay(int i, boolean enable, float r)
+ {
+ overlays.enable(i, enable);
+ overlays.rotate(i, r);
+ if (enable) return true;
+ return mustBeDrawn();
+ }
+
@Override
public void draw(Batch batch)
{
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
index 1397c9d..a659c68 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java
@@ -47,6 +47,11 @@ public class StackedImages implements Drawable, Disposable
return false;
}
+ public void rotate(int i, float r)
+ {
+ sprites.get(i).setRotation(r);
+ }
+
public void setRotation(float r)
{
for (int i = 0, n = sprites.size; i < n; i++)