summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-27 02:00:41 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-27 02:00:41 +0100
commitea5ba19d09479a11a83b54e582b1c989193b29d9 (patch)
treed786fcc665209267dcffb8a0737b8c828f80f835 /core/src/ch/asynk/gdx
parent8b7743eececa744c66d4dab6ba863e7c988570c2 (diff)
downloadgdx-boardgame-ea5ba19d09479a11a83b54e582b1c989193b29d9.zip
gdx-boardgame-ea5ba19d09479a11a83b54e582b1c989193b29d9.tar.gz
ui : Element swallows draw() drawDebu() out of dying Assembly
Diffstat (limited to 'core/src/ch/asynk/gdx')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Assembly.java11
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Element.java12
2 files changed, 11 insertions, 12 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Assembly.java b/core/src/ch/asynk/gdx/boardgame/ui/Assembly.java
index 28a7597..b2c2cec 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Assembly.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Assembly.java
@@ -46,15 +46,4 @@ public abstract class Assembly extends Element
}
return false;
}
-
- @Override public void draw(Batch batch)
- {
- if (tainted) computeGeometry();
- children.forEach( c -> c.draw(batch) );
- }
-
- @Override public void drawDebug(ShapeRenderer shapeRenderer)
- {
- children.forEach( c -> c.drawDebug(shapeRenderer) );
- }
}
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
index 73d068f..5e28c1d 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
@@ -1,5 +1,6 @@
package ch.asynk.gdx.boardgame.ui;
+import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
@@ -9,7 +10,7 @@ import ch.asynk.gdx.boardgame.Positionable;
import ch.asynk.gdx.boardgame.Touchable;
import ch.asynk.gdx.boardgame.utils.IterableSet;
-public abstract class Element implements Drawable, Paddable, Positionable, Touchable
+public class Element implements Drawable, Paddable, Positionable, Touchable
{
public static boolean DEBUG_GEOMETRY = false;
public static int DEFAULT_CHILD_COUNT = 2;
@@ -99,9 +100,18 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
}
}
+
+ @Override public void draw(Batch batch)
+ {
+ if (tainted) computeGeometry();
+ children.forEach( c -> c.draw(batch) );
+ }
+
@Override public void drawDebug(ShapeRenderer shapeRenderer)
{
shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());
+ if (children != null)
+ children.forEach( c -> c.drawDebug(shapeRenderer) );
}
@Override public boolean touch(float x, float y)