diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-02-12 17:08:37 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-02-12 17:08:37 +0100 |
commit | b90d4dd1963506b96cbde1e99d77110304b09257 (patch) | |
tree | 65e223554905794cbae044667ebefdf0ec63fa5b /core | |
parent | 8e313b2a0df743045dc5d3a45993b86d0b19f894 (diff) | |
download | RustAndDust-b90d4dd1963506b96cbde1e99d77110304b09257.zip RustAndDust-b90d4dd1963506b96cbde1e99d77110304b09257.tar.gz |
Widget: simple rewrite
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/ui/Widget.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/Widget.java b/core/src/ch/asynk/rustanddust/ui/Widget.java index 8dfa029..838993d 100644 --- a/core/src/ch/asynk/rustanddust/ui/Widget.java +++ b/core/src/ch/asynk/rustanddust/ui/Widget.java @@ -65,16 +65,16 @@ public abstract class Widget implements Disposable, Drawable public void setParent(Widget parent) { + float x, y; this.parent = parent; if (parent == null) { - rect.x = position.getX(rect.width); - rect.y = position.getY(rect.height); + x = position.getX(rect.width); + y = position.getY(rect.height); } else { - rect.x = position.getX(parent, rect.width); - rect.y = position.getY(parent, rect.height); + x = position.getX(parent, rect.width); + y = position.getY(parent, rect.height); } - // might trigger something if overriden - setPosition(rect.x, rect.y, rect.width, rect.height); + setPosition(x, y); } public boolean hit(float x, float y) |