summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Piece.java5
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Positionable.java6
2 files changed, 5 insertions, 6 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Piece.java b/core/src/ch/asynk/gdx/boardgame/Piece.java
index 6b7f2b4..a2017b0 100644
--- a/core/src/ch/asynk/gdx/boardgame/Piece.java
+++ b/core/src/ch/asynk/gdx/boardgame/Piece.java
@@ -27,11 +27,6 @@ public class Piece extends Sprite implements Drawable, Positionable, Rotable, Sc
return getScaleX();
}
- @Override public void centerOn(float cx, float cy)
- {
- setPosition((cx - (getWidth() / 2f)), (cy - (getHeight() / 2f)));
- }
-
public void getPosOn(Tile tile, Orientation orientation, Vector3 v)
{
v.set((tile.x - (getWidth() / 2f)), (tile.y- (getHeight() / 2f)), orientation.r());
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)));
+ }
}