diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Layer.java | 10 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/AbstractDrawable.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/Drawable.java | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Layer.java b/core/src/ch/asynk/tankontank/engine/Layer.java index 76f99c0..203c469 100644 --- a/core/src/ch/asynk/tankontank/engine/Layer.java +++ b/core/src/ch/asynk/tankontank/engine/Layer.java @@ -8,6 +8,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.viewport.Viewport; import ch.asynk.tankontank.engine.gfx.Node; @@ -100,6 +101,15 @@ public class Layer } } + public void drawDebug(ShapeRenderer debugShapes) + { + debugShapes.setProjectionMatrix(viewport.getCamera().combined); + debugShapes.begin(); + for (int i = 0, n = nodes.size(); i < n; i++) + nodes.get(i).drawDebug(debugShapes); + debugShapes.end(); + } + public void clear() { for (int i = 0, n = nodes.size(); i < n; i++) diff --git a/core/src/ch/asynk/tankontank/engine/gfx/AbstractDrawable.java b/core/src/ch/asynk/tankontank/engine/gfx/AbstractDrawable.java index 5d4705c..bfafb38 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/AbstractDrawable.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/AbstractDrawable.java @@ -1,6 +1,7 @@ package ch.asynk.tankontank.engine.gfx; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; public abstract class AbstractDrawable implements Drawable { @@ -24,6 +25,9 @@ public abstract class AbstractDrawable implements Drawable } @Override + public void drawDebug(ShapeRenderer debugShapes) {} + + @Override public float getWidth() { return w; diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Drawable.java b/core/src/ch/asynk/tankontank/engine/gfx/Drawable.java index 8b700df..075c33d 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/Drawable.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/Drawable.java @@ -1,6 +1,7 @@ package ch.asynk.tankontank.engine.gfx; import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Disposable; public interface Drawable extends Disposable @@ -26,4 +27,6 @@ public interface Drawable extends Disposable public void setCoords(float x, float y, int r); public void draw(Batch batch, float parentAlpha); + + public void drawDebug(ShapeRenderer debugShapes); } |