From b3d997a6f50c2337e799954bcf31b643a8463da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 17 May 2016 17:48:40 +0200 Subject: LabelImage: override setPosition(...) to call label.update(), for this to work, Bg must directly call rect.set(...) at init --- core/src/ch/asynk/rustanddust/ui/Bg.java | 2 +- core/src/ch/asynk/rustanddust/ui/LabelImage.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/rustanddust/ui/Bg.java b/core/src/ch/asynk/rustanddust/ui/Bg.java index 72fdd2a..081ff93 100644 --- a/core/src/ch/asynk/rustanddust/ui/Bg.java +++ b/core/src/ch/asynk/rustanddust/ui/Bg.java @@ -12,7 +12,7 @@ public class Bg extends Widget { super(); this.region = region; - setPosition(0, 0, region.getRegionWidth() * SCALE, region.getRegionHeight() * SCALE); + rect.set(0, 0, region.getRegionWidth() * SCALE, region.getRegionHeight() * SCALE); } public static void setScale(float scale) diff --git a/core/src/ch/asynk/rustanddust/ui/LabelImage.java b/core/src/ch/asynk/rustanddust/ui/LabelImage.java index eb26f7f..afbaa25 100644 --- a/core/src/ch/asynk/rustanddust/ui/LabelImage.java +++ b/core/src/ch/asynk/rustanddust/ui/LabelImage.java @@ -46,6 +46,13 @@ public class LabelImage extends Bg label.update(); } + @Override + public void setPosition(float x, float y, float w, float h) + { + rect.set(x, y, w, h); + label.update(); + } + public void setLabelPosition(Position position) { label.setPosition(position, this); -- cgit v1.1-2-g2b99