diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-23 12:25:22 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-01-23 12:25:22 +0100 |
commit | 17e2865cbdb7abb92b3b0804275465c57ebf36c3 (patch) | |
tree | f925044b806542c914251bdd60f94eaf52879836 /core | |
parent | b0641f54015894e6a78aa648d44c7c019d5559a0 (diff) | |
download | gdx-boardgame-17e2865cbdb7abb92b3b0804275465c57ebf36c3.zip gdx-boardgame-17e2865cbdb7abb92b3b0804275465c57ebf36c3.tar.gz |
Piece : add angleCorrection, fix boards angles
Diffstat (limited to 'core')
4 files changed, 17 insertions, 5 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Piece.java b/core/src/ch/asynk/gdx/boardgame/Piece.java index 275ea58..43bef04 100644 --- a/core/src/ch/asynk/gdx/boardgame/Piece.java +++ b/core/src/ch/asynk/gdx/boardgame/Piece.java @@ -18,6 +18,8 @@ import ch.asynk.gdx.boardgame.Tile; public class Piece extends Sprite implements Drawable, Positionable, Rotable, Scalable { + public static int angleCorrection = 0; + public Piece(Texture texture) { super(texture); @@ -77,4 +79,14 @@ public class Piece extends Sprite implements Drawable, Positionable, Rotable, Sc float h = getHeight(); shapeRenderer.rect(getX(), getY(), (w / 2f), (h / 2f), w, h, getScaleX(), getScaleY(), getRotation()); } + + @Override public void setRotation(float r) + { + super.setRotation(r - angleCorrection); + } + + @Override public float getRotation() + { + return super.getRotation() + angleCorrection; + } } diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 688e1a0..5d7e401 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -39,8 +39,8 @@ public class HexBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] vAngles = {-90, -30, -1, 30, 90, 150, -1, 210, -30}; - private static final int [] hAngles = { -1, -60, 0, 60, -1, 120, 180, 240, -60}; + private static final int [] vAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 60}; + private static final int [] hAngles = { -1, 30, 90, 150, -1, 210, 270, 330, 30}; public HexBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) { diff --git a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java index 7e381e9..f7df4ff 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java @@ -12,7 +12,7 @@ public class SquareBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] angles = {0, -1, 90, -1, 180, -1, 270, -1, 0, 90}; + private static final int [] angles = {0, -1, 90, -1, 180, -1, 270, -1, 90}; public SquareBoard(int cols, int rows, float side, float x0, float y0) { diff --git a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java index 2ea7237..dfbd42d 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java @@ -20,8 +20,8 @@ public class TriangleBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] vAngles = {-1, 30, 90, 150, -1, 210, 270, 330, 30}; - private static final int [] hAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 60}; + private static final int [] vAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 0}; + private static final int [] hAngles = { -1, 30, 90, 150, -1, 210, 270, 330, 30}; public TriangleBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) { |