summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Orientation.java22
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java5
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java3
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java5
4 files changed, 21 insertions, 14 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Orientation.java b/core/src/ch/asynk/gdx/boardgame/Orientation.java
index 166830a..8450dff 100644
--- a/core/src/ch/asynk/gdx/boardgame/Orientation.java
+++ b/core/src/ch/asynk/gdx/boardgame/Orientation.java
@@ -29,15 +29,19 @@ public enum Orientation
public static void setValues(int [] angles)
{
- DEFAULT.r = angles[0];
- E.r = angles[1];
- NE.r = angles[2];
- N.r = angles[3];
- NW.r = angles[4];
- W.r = angles[5];
- SW.r = angles[6];
- S.r = angles[7];
- SE.r = angles[8];
+ for (int i = 0; i < angles.length; i++) {
+ if (angles[i] < 0 && angles[i] != -1)
+ angles[i] += 360;
+ }
+ E.r = angles[0];
+ NE.r = angles[1];
+ N.r = angles[2];
+ NW.r = angles[3];
+ W.r = angles[4];
+ SW.r = angles[5];
+ S.r = angles[6];
+ SE.r = angles[7];
+ DEFAULT.r = angles[8];
}
public int allBut()
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
index 00704ef..688e1a0 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
@@ -38,8 +38,9 @@ public class HexBoard implements Board
// bottom left is the left vertice of the most bottom-left horizontal hex side of the map
// [0] is 0° facing East
- private static final int [] vAngles = {60, 0, 60, -1, 120, 180, 240, -1, 300};
- private static final int [] hAngles = {90, -1, 30, 90, 150, -1, 210, 270, 330};
+ // [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};
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 7f5de42..7e381e9 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java
@@ -11,7 +11,8 @@ public class SquareBoard implements Board
private final float y0; // bottom left y offset
// [0] is 0° facing East
- private static final int [] angles = {90, 0, -1, 90, -1, 180, -1, 270, -1, 0};
+ // [8] is default
+ private static final int [] angles = {0, -1, 90, -1, 180, -1, 270, -1, 0, 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 4c9a013..2ea7237 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java
@@ -19,8 +19,9 @@ public class TriangleBoard implements Board
private final float h43; // 4/3 height of the triangle
// [0] is 0° facing East
- private static final int [] vAngles = {60, 0, 60, -1, 120, 180, 240, -1, 300};
- private static final int [] hAngles = {30, -1, 30, 90, 150, -1, 210, 270, 330};
+ // [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};
public TriangleBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation)
{