summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/Positionable.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-11-23 15:54:38 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2018-11-23 15:54:38 +0100
commite2e3fb2311e1b1f2a7ccd057288aae635f9f6b9d (patch)
tree685138314cc76dcf3ad722392642fea4cd271177 /core/src/ch/asynk/gdx/boardgame/Positionable.java
parente62c838c3da5cd091c86844d3e8649ba4c3fe5dd (diff)
downloadgdx-boardgame-e2e3fb2311e1b1f2a7ccd057288aae635f9f6b9d.zip
gdx-boardgame-e2e3fb2311e1b1f2a7ccd057288aae635f9f6b9d.tar.gz
Positionable : give default centerOn() implementation
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/Positionable.java')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Positionable.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Positionable.java b/core/src/ch/asynk/gdx/boardgame/Positionable.java
index 30128ac..53d92f8 100644
--- a/core/src/ch/asynk/gdx/boardgame/Positionable.java
+++ b/core/src/ch/asynk/gdx/boardgame/Positionable.java
@@ -6,7 +6,11 @@ public interface Positionable
public float getY();
public float getWidth();
public float getHeight();
- public void centerOn(float cx, float cy);
public void translate(float dx, float dy);
public void setPosition(float x, float y);
+
+ default public void centerOn(float cx, float cy)
+ {
+ setPosition((cx - (getWidth() / 2f)), (cy - (getHeight() / 2f)));
+ }
}