summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-17 17:43:06 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-17 17:43:06 +0100
commit5d809c28ea2b6a5779a512aeef09308006670284 (patch)
tree0fe853e97e79361425bb837458e8740be9cf3d02 /core/src/ch
parentb622f772ad2e30b1ad051e8d3b36cc991dd0053c (diff)
downloadgdx-boardgame-5d809c28ea2b6a5779a512aeef09308006670284.zip
gdx-boardgame-5d809c28ea2b6a5779a512aeef09308006670284.tar.gz
Element : add toString()
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Element.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
index 59304b5..6c10841 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
@@ -48,6 +48,28 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
@Override public final float getInnerWidth() { return rect.width - 2 * padding; }
@Override public final float getInnerHeight() { return rect.height - 2 * padding; }
+ @Override public String toString()
+ {
+ return print(0);
+ }
+
+ protected String print(int level)
+ {
+ String suffix = "";
+ for (int i = 0; i < level; i++)
+ suffix += " ";
+
+ String r = suffix;
+ r += getClass().getName() + " : " + (int)x + " " + (int)y +
+ " [" + (int)rect.x + " " + (int)rect.y + " " + (int)rect.width + " " + (int)rect.height + "] +" +
+ (int)padding + " " + alignment;
+ if (parent != null)
+ r += "\n" + parent.print(level + 1);
+ else
+ r += "\n" + suffix + " *";
+ return r;
+ }
+
@Override public void drawDebug(ShapeRenderer shapeRenderer)
{
shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());