diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-09 11:45:59 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-09 11:45:59 +0200 |
commit | 30b53f449678212b799d198672d570644b32b7c0 (patch) | |
tree | d3b526a73ca77f2d97fcec72aba375fdb7f2d4c4 | |
parent | 5b4d135eed6ebe8a32c283677592eed6bb851e38 (diff) | |
download | gdx-boardgame-30b53f449678212b799d198672d570644b32b7c0.zip gdx-boardgame-30b53f449678212b799d198672d570644b32b7c0.tar.gz |
ui/Element : adapt to Positionable interface
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Element.java | 9 |
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); } |