diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-18 16:51:35 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-18 16:51:35 +0200 |
commit | 3b34d467feca5b255f598f77865208aeecdbb4c6 (patch) | |
tree | 9dcab7ec04319d65427f0bbe9d23e721a8e1c8d6 /core/src | |
parent | 132094f02ec5134c1b47553c1655d880f4127782 (diff) | |
download | gdx-boardgame-3b34d467feca5b255f598f77865208aeecdbb4c6.zip gdx-boardgame-3b34d467feca5b255f598f77865208aeecdbb4c6.tar.gz |
Tile : add overlays, implement Drawable
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/Tile.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Tile.java b/core/src/ch/asynk/gdx/boardgame/Tile.java index ae0bb70..5c07866 100644 --- a/core/src/ch/asynk/gdx/boardgame/Tile.java +++ b/core/src/ch/asynk/gdx/boardgame/Tile.java @@ -1,14 +1,40 @@ package ch.asynk.gdx.boardgame; -public class Tile +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; + +import ch.asynk.gdx.boardgame.Overlays; + +public class Tile implements Drawable { + public static TextureAtlas defaultOverlay = null; + public float x; public float y; + private Overlays overlays; public Tile(float x, float y) { this.x = x; this.y = y; + if (defaultOverlay != null) { + this.overlays = new Overlays(defaultOverlay); + this.overlays.centerOn(x, y); + } + } + + @Override public void draw(Batch batch) + { + if (overlays != null) { + overlays.draw(batch); + } + } + + public void enableOverlay(int i, boolean enable) + { + if (overlays != null) { + overlays.enable(i, enable); + } } @Override public String toString() |