diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2019-12-17 16:22:28 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2019-12-17 16:22:28 +0100 |
commit | bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe (patch) | |
tree | 829e1f7b008c5262e4dd777015732582e26009c4 /core/src/ch/asynk/gdx/boardgame/FramedSprite.java | |
parent | 36d827659b54b04c90722eb2e431f622b33c047c (diff) | |
download | gdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.zip gdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.tar.gz |
core : implement drawDebug(ShapeRenderer)
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/FramedSprite.java')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/FramedSprite.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/FramedSprite.java b/core/src/ch/asynk/gdx/boardgame/FramedSprite.java index 1f60f9c..8fc2e80 100644 --- a/core/src/ch/asynk/gdx/boardgame/FramedSprite.java +++ b/core/src/ch/asynk/gdx/boardgame/FramedSprite.java @@ -3,6 +3,7 @@ package ch.asynk.gdx.boardgame; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; public class FramedSprite implements Drawable, Positionable { @@ -101,4 +102,18 @@ public class FramedSprite implements Drawable, Positionable { batch.draw(frame, x, y, 0, 0, frame.getRegionWidth(), frame.getRegionHeight(), 1f, 1f, r); } + + @Override public void drawDebug(ShapeRenderer shapeRenderer) + { + shapeRenderer.end(); + shapeRenderer.begin(ShapeRenderer.ShapeType.Line); + shapeRenderer.identity(); + shapeRenderer.translate(x, y, 0); + shapeRenderer.rotate(0, 0, 1, r); + shapeRenderer.translate(-x, -y, 0); + shapeRenderer.rect(x, y, frame.getRegionWidth(), frame.getRegionHeight()); + shapeRenderer.end(); + shapeRenderer.begin(ShapeRenderer.ShapeType.Line); + shapeRenderer.identity(); + } } |