diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-23 13:56:30 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-23 13:56:30 +0100 |
commit | 903db05854ebf145fbb5dff2713753172ae56fda (patch) | |
tree | 997b6a526abc263ba77e4427f3e559aa3b40da48 | |
parent | 17e2865cbdb7abb92b3b0804275465c57ebf36c3 (diff) | |
download | gdx-boardgame-903db05854ebf145fbb5dff2713753172ae56fda.zip gdx-boardgame-903db05854ebf145fbb5dff2713753172ae56fda.tar.gz |
Tile : add boolean overlaysEnabled(), void setOverlay(TextureAtlas)
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/Tile.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Tile.java b/core/src/ch/asynk/gdx/boardgame/Tile.java index de53a4e..454f839 100644 --- a/core/src/ch/asynk/gdx/boardgame/Tile.java +++ b/core/src/ch/asynk/gdx/boardgame/Tile.java @@ -19,16 +19,22 @@ public class Tile implements Drawable this.x = x; this.y = y; if (defaultOverlay != null) { - this.overlays = new Overlays(defaultOverlay); - this.overlays.centerOn(x, y); + setOverlay(defaultOverlay); } } - @Override public void draw(Batch batch) + public boolean overlaysEnabled() { if (overlays != null) { - overlays.draw(batch); + return overlays.isEnabled(); } + return false; + } + + public void setOverlay(TextureAtlas textureAtlas) + { + this.overlays = new Overlays(textureAtlas); + this.overlays.centerOn(x, y); } public void enableOverlay(int i, boolean enable) @@ -51,6 +57,13 @@ public class Tile implements Drawable return "[" + x + ", " + y + "]"; } + @Override public void draw(Batch batch) + { + if (overlays != null) { + overlays.draw(batch); + } + } + @Override public void drawDebug(ShapeRenderer shapeRenderer) { if (overlays != null) { |