From 30b53f449678212b799d198672d570644b32b7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 9 Oct 2018 11:45:59 +0200 Subject: ui/Element : adapt to Positionable interface --- core/src/ch/asynk/gdx/boardgame/ui/Element.java | 9 +++++++-- 1 file 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); } -- cgit v1.1-2-g2b99