summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-05-17 17:33:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-05-17 17:33:22 +0200
commitcdc1902b681c3b3d4b0f48bd77948db8907c9dd1 (patch)
tree98648e70e4374f7058b703800abd9e3b7e97426d
parentfd9084383d54cce1c51e4f3048c14964d11dc705 (diff)
downloadRustAndDust-cdc1902b681c3b3d4b0f48bd77948db8907c9dd1.zip
RustAndDust-cdc1902b681c3b3d4b0f48bd77948db8907c9dd1.tar.gz
Widget: add update() called by setParent(Widget)
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Widget.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/Widget.java b/core/src/ch/asynk/rustanddust/ui/Widget.java
index 6605158..9460833 100644
--- a/core/src/ch/asynk/rustanddust/ui/Widget.java
+++ b/core/src/ch/asynk/rustanddust/ui/Widget.java
@@ -66,8 +66,13 @@ public abstract class Widget implements Disposable, Drawable
public void setParent(Widget parent)
{
- float x, y;
this.parent = parent;
+ update();
+ }
+
+ public void update()
+ {
+ float x, y;
if (parent == null) {
x = position.getX(rect.width);
y = position.getY(rect.height);