diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Button.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Element.java | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Button.java b/core/src/ch/asynk/gdx/boardgame/ui/Button.java index 2b1638b..965e126 100644 --- a/core/src/ch/asynk/gdx/boardgame/ui/Button.java +++ b/core/src/ch/asynk/gdx/boardgame/ui/Button.java @@ -26,8 +26,7 @@ public class Button extends Patch this.padding = padding; this.spacing = spacing; label = new Label(font); - label.setParent(this); - label.setAlignment(Alignment.MIDDLE_CENTER); + label.setParent(this, Alignment.MIDDLE_CENTER); } public void write(String text) diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java index 615c345..e24498b 100644 --- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java +++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java @@ -77,7 +77,13 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch public void setParent(Element parent) { + setParent(parent, null); + } + + public void setParent(Element parent, Alignment alignment) + { this.parent = parent; + if (alignment != null) this.alignment = alignment; taint(); } |