summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-10-09 11:45:59 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-10-09 11:45:59 +0200
commit30b53f449678212b799d198672d570644b32b7c0 (patch)
treed3b526a73ca77f2d97fcec72aba375fdb7f2d4c4 /core
parent5b4d135eed6ebe8a32c283677592eed6bb851e38 (diff)
downloadgdx-boardgame-30b53f449678212b799d198672d570644b32b7c0.zip
gdx-boardgame-30b53f449678212b799d198672d570644b32b7c0.tar.gz
ui/Element : adapt to Positionable interface
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/ui/Element.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
index 5f5fcb3..a7a820a 100644
--- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java
+++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java
@@ -85,7 +85,12 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
this.tainted = true;
}
- public final void translate(float dx, float dy)
+ @Override public final void centerOn(float cx, float cy)
+ {
+ setPosition((cx - (rect.width / 2f)), (cy - (rect.height / 2f)));
+ }
+
+ @Override public final void translate(float dx, float dy)
{
setPosition(x + dx, y + dy);
}
@@ -95,7 +100,7 @@ public abstract class Element implements Drawable, Paddable, Positionable, Touch
setPosition(r.x, r.x, r.width, r.height);
}
- public final void setPosition(float x, float y)
+ @Override public final void setPosition(float x, float y)
{
setPosition(x, y, rect.width, rect.height);
}