summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/Positionable.java
blob: 36a9cdad3f97b890e48e4b0d32cf87d4ad9fd548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package ch.asynk.gdx.boardgame;

public interface Positionable
{
    public float getX();
    public float getY();
    public float getWidth();
    public float getHeight();
    public void translate(float dx, float dy);
    public void setPosition(float x, float y);
    default public float getCX() { return getX() + (getWidth() / 2f); }
    default public float getCY() { return getY() + (getHeight() / 2f); }

    default public void centerOn(float cx, float cy)
    {
        setPosition((cx - (getWidth() / 2f)), (cy - (getHeight() / 2f)));
    }
}