From b90d4dd1963506b96cbde1e99d77110304b09257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 12 Feb 2016 17:08:37 +0100 Subject: Widget: simple rewrite --- core/src/ch/asynk/rustanddust/ui/Widget.java | 12 ++++++------ 1 file 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) -- cgit v1.1-2-g2b99