summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-01-23 17:05:54 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2020-01-23 17:05:54 +0100
commit591ede163eb28e6c74c584503050fda2a419e815 (patch)
tree5fd7b19e8e2fecef1fb017f190036d528b111876 /core/src/ch
parent416490c4382cfde163be376d978d7890da81bcd5 (diff)
downloadgdx-boardgame-591ede163eb28e6c74c584503050fda2a419e815.zip
gdx-boardgame-591ede163eb28e6c74c584503050fda2a419e815.tar.gz
Board : extends TileKeyGenerator
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/Board.java5
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java2
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java2
-rw-r--r--core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java6
4 files changed, 8 insertions, 7 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/Board.java b/core/src/ch/asynk/gdx/boardgame/boards/Board.java
index b1adf1c..f12391a 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/Board.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/Board.java
@@ -2,11 +2,12 @@ package ch.asynk.gdx.boardgame.boards;
import com.badlogic.gdx.math.Vector2;
-public interface Board
+import ch.asynk.gdx.boardgame.TileStorage.TileKeyGenerator;
+
+public interface Board extends TileKeyGenerator
{
public int[] getAngles();
public int size();
- public int getIdx(int x, int y);
public boolean isOnMap(int x, int y);
public void centerOf(int x, int y, Vector2 v);
public void toBoard(float x, float y, Vector2 v);
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
index 5d7e401..8ab660b 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java
@@ -82,7 +82,7 @@ public class HexBoard implements Board
}
}
- @Override public int getIdx(int x, int y)
+ @Override public int genKey(int x, int y)
{
if (!isOnMap(x, y)) return -1;
if (this.orientation == BoardFactory.BoardOrientation.VERTICAL) {
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java
index f7df4ff..b9e2426 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java
@@ -30,7 +30,7 @@ public class SquareBoard implements Board
return angles;
}
- @Override public int getIdx(int x, int y)
+ @Override public int genKey(int x, int y)
{
return (y * cols + x);
}
diff --git a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java
index dfbd42d..6cbc69f 100644
--- a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java
+++ b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java
@@ -40,9 +40,7 @@ public class TriangleBoard implements Board
this.h43 = this.h * 1.33333f;
}
- // FIXME size() getIdx(int, int)
- @Override public int size() { return 1; }
- @Override public int getIdx(int x, int y) { return -1; }
+ @Override public int size() { return 0; } // FIXME
@Override public int[] getAngles()
{
@@ -53,6 +51,8 @@ public class TriangleBoard implements Board
}
}
+ @Override public int genKey(int x, int y) { return -1; } // FIXME
+
@Override public boolean isOnMap(int x, int y)
{
if (this.orientation == BoardFactory.BoardOrientation.VERTICAL) {