diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-17 17:48:40 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-17 17:48:40 +0200 |
commit | b3d997a6f50c2337e799954bcf31b643a8463da5 (patch) | |
tree | 3202e5f476d734156130740c5f087e084e140fa6 /core | |
parent | 8bf85d12922e2824bf9569239a3c71e47b654feb (diff) | |
download | RustAndDust-b3d997a6f50c2337e799954bcf31b643a8463da5.zip RustAndDust-b3d997a6f50c2337e799954bcf31b643a8463da5.tar.gz |
LabelImage: override setPosition(...) to call label.update(), for this to work, Bg must directly call rect.set(...) at init
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/ui/Bg.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/ui/LabelImage.java | 7 |
2 files changed, 8 insertions, 1 deletions
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); |