From 903db05854ebf145fbb5dff2713753172ae56fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 23 Jan 2020 13:56:30 +0100 Subject: Tile : add boolean overlaysEnabled(), void setOverlay(TextureAtlas) --- core/src/ch/asynk/gdx/boardgame/Tile.java | 21 +++++++++++++++++---- 1 file 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) { -- cgit v1.1-2-g2b99