diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-27 08:49:13 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-27 08:49:13 +0100 |
commit | 98b46c29d1b11cd8492911dd242de60aedc44964 (patch) | |
tree | 917c47d13aac31d856551eed4ed7667988ed4d82 /core/src/ch/asynk/gdx/boardgame | |
parent | 1939a1b80b270010fb7ff3633d102dfb27a8c276 (diff) | |
download | gdx-boardgame-98b46c29d1b11cd8492911dd242de60aedc44964.zip gdx-boardgame-98b46c29d1b11cd8492911dd242de60aedc44964.tar.gz |
Piece : private head -> protected sprite
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/Piece.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Piece.java b/core/src/ch/asynk/gdx/boardgame/Piece.java index 47174fd..ee0353a 100644 --- a/core/src/ch/asynk/gdx/boardgame/Piece.java +++ b/core/src/ch/asynk/gdx/boardgame/Piece.java @@ -21,7 +21,7 @@ public class Piece implements Drawable, Positionable, Rotable, Scalable { public static int angleCorrection = 0; - private Sprite head; + protected Sprite sprite; public Piece(Texture texture) { @@ -30,7 +30,7 @@ public class Piece implements Drawable, Positionable, Rotable, Scalable public void setHead(Texture texture) { - head = new Sprite(texture); + sprite = new Sprite(texture); } public void getPosOn(Tile tile, Orientation orientation, Vector3 v) @@ -76,43 +76,43 @@ public class Piece implements Drawable, Positionable, Rotable, Scalable v.set(getX()+ (getWidth() / 2f), getY() + (getHeight() / 2f)); } - @Override public float getX() { return head.getX(); } - @Override public float getY() { return head.getY(); } - @Override public float getWidth() { return head.getWidth(); } - @Override public float getHeight() { return head.getHeight(); } - @Override public void translate(float x, float y) { head.translate(x, y); } - @Override public void setPosition(float x, float y) { head.setPosition(x, y); } + @Override public float getX() { return sprite.getX(); } + @Override public float getY() { return sprite.getY(); } + @Override public float getWidth() { return sprite.getWidth(); } + @Override public float getHeight() { return sprite.getHeight(); } + @Override public void translate(float x, float y) { sprite.translate(x, y); } + @Override public void setPosition(float x, float y) { sprite.setPosition(x, y); } @Override public float getScale() { - return head.getScaleX(); + return sprite.getScaleX(); } @Override public void setScale(float s) { - head.setScale(s); + sprite.setScale(s); } @Override public float getRotation() { - return head.getRotation() + angleCorrection; + return sprite.getRotation() + angleCorrection; } @Override public void setRotation(float r) { - head.setRotation(r - angleCorrection); + sprite.setRotation(r - angleCorrection); } @Override public void draw(Batch batch) { - head.draw(batch); + sprite.draw(batch); } @Override public void drawDebug(ShapeRenderer shapeRenderer) { float w = getWidth(); float h = getHeight(); - shapeRenderer.rect(getX(), getY(), (w / 2f), (h / 2f), w, h, head.getScaleX(), head.getScaleY(), getRotation()); + shapeRenderer.rect(getX(), getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), getRotation()); } } |