summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/Overlays.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-17 16:22:28 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-17 16:22:28 +0100
commitbc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe (patch)
tree829e1f7b008c5262e4dd777015732582e26009c4 /core/src/ch/asynk/gdx/boardgame/Overlays.java
parent36d827659b54b04c90722eb2e431f622b33c047c (diff)
downloadgdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.zip
gdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.tar.gz
core : implement drawDebug(ShapeRenderer)
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/Overlays.java')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Overlays.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Overlays.java b/core/src/ch/asynk/gdx/boardgame/Overlays.java
index 392d1cd..5746630 100644
--- a/core/src/ch/asynk/gdx/boardgame/Overlays.java
+++ b/core/src/ch/asynk/gdx/boardgame/Overlays.java
@@ -3,6 +3,7 @@ package ch.asynk.gdx.boardgame;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.utils.Array;
import ch.asynk.gdx.boardgame.Drawable;
@@ -120,4 +121,18 @@ public class Overlays implements Drawable, Positionable, Rotable, Scalable
}
}
}
+
+ @Override public void drawDebug(ShapeRenderer shapeRenderer)
+ {
+ if (!isEnabled) return;
+ for (int i = 0, n = sprites.size; i < n; i++) {
+ if (enabled[i]) {
+ final Sprite sprite = sprites.get(i);
+ float w = sprite.getWidth();
+ float h = sprite.getHeight();
+ shapeRenderer.rect(sprite.getX(), sprite.getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), sprite.getRotation());
+ return;
+ }
+ }
+ }
}