summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-09-14 16:12:12 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-09-14 16:12:12 +0200
commit305e4d663036ea501cd227e088ebbdd146b476b2 (patch)
tree9323a57f0dc6496de657c0a9966353aa795dd599
parent90457d70af946143fee8d41e5a102db10f3013d2 (diff)
downloadgdx-boardgame-305e4d663036ea501cd227e088ebbdd146b476b2.zip
gdx-boardgame-305e4d663036ea501cd227e088ebbdd146b476b2.tar.gz
add tests for TriangleBoard
-rw-r--r--assets/data/triangle.pngbin0 -> 836880 bytes
-rw-r--r--test/src/ch/asynk/gdx/board/test/Assets.java3
-rw-r--r--test/src/ch/asynk/gdx/board/test/GameBoard.java30
-rw-r--r--test/src/ch/asynk/gdx/board/test/GameHud.java6
-rw-r--r--test/src/ch/asynk/gdx/board/test/GameScreen.java6
5 files changed, 39 insertions, 6 deletions
diff --git a/assets/data/triangle.png b/assets/data/triangle.png
new file mode 100644
index 0000000..738854b
--- /dev/null
+++ b/assets/data/triangle.png
Binary files differ
diff --git a/test/src/ch/asynk/gdx/board/test/Assets.java b/test/src/ch/asynk/gdx/board/test/Assets.java
index db9d0b0..9d5c9ee 100644
--- a/test/src/ch/asynk/gdx/board/test/Assets.java
+++ b/test/src/ch/asynk/gdx/board/test/Assets.java
@@ -17,6 +17,7 @@ public class Assets extends ch.asynk.gdx.board.Assets
public static final String CORNER = "corner.png";
public static final String MAP_00 = "map_00.png";
public static final String CHESS = "chess.jpg";
+ public static final String TRI = "triangle.png";
public static final String FONT = "veteran-typewriter.ttf";
public static final String FONT_20 = "size20.ttf";
public static final String FONT_25 = "size25.ttf";
@@ -60,6 +61,7 @@ public class Assets extends ch.asynk.gdx.board.Assets
{
load(MAP_00, Texture.class);
load(CHESS, Texture.class);
+ load(TRI, Texture.class);
load(CORNER, Texture.class);
load(PATCH, Texture.class);
load(FONT_20, BitmapFont.class, params20);
@@ -70,6 +72,7 @@ public class Assets extends ch.asynk.gdx.board.Assets
{
unload(MAP_00);
unload(CHESS);
+ unload(TRI);
unload(CORNER);
unload(PATCH);
unload(FONT_20);
diff --git a/test/src/ch/asynk/gdx/board/test/GameBoard.java b/test/src/ch/asynk/gdx/board/test/GameBoard.java
index 3d3d246..9563119 100644
--- a/test/src/ch/asynk/gdx/board/test/GameBoard.java
+++ b/test/src/ch/asynk/gdx/board/test/GameBoard.java
@@ -57,6 +57,12 @@ public class GameBoard implements Disposable, Touchable
case SQUARE:
setSQUARE();
break;
+ case TRI_H:
+ setTRI_H();
+ break;
+ case TRI_V:
+ setTRI_V();
+ break;
}
}
@@ -88,9 +94,31 @@ public class GameBoard implements Disposable, Touchable
r = 0;
dx = 0;
dy = 0;
+ w = map.getWidth();
+ h = map.getHeight();
+ this.board = BoardFactory.getBoard(BoardFactory.BoardType.SQUARE, 83, 5, 5);
+ }
+
+ private void setTRI_H()
+ {
+ this.map = assets.getTexture(assets.TRI);
+ r = 0;
+ dx = 0;
+ dy = 0;
+ w = map.getWidth();
+ h = map.getHeight();
+ this.board = BoardFactory.getBoard(BoardFactory.BoardType.TRIANGLE, 150, 109, 53, BoardFactory.BoardOrientation.HORIZONTAL);
+ }
+
+ private void setTRI_V()
+ {
+ this.map = assets.getTexture(assets.TRI);
+ r = 90;
+ dx = - ( this.map.getWidth() - this.map.getHeight() ) / 2;
+ dy = - dx;
w = map.getHeight();
h = map.getWidth();
- this.board = BoardFactory.getBoard(BoardFactory.BoardType.SQUARE, 83, 5, 5);
+ this.board = BoardFactory.getBoard(BoardFactory.BoardType.TRIANGLE, 150, 16, 110, BoardFactory.BoardOrientation.VERTICAL);
}
public int getWidth()
diff --git a/test/src/ch/asynk/gdx/board/test/GameHud.java b/test/src/ch/asynk/gdx/board/test/GameHud.java
index 3fc4454..8709846 100644
--- a/test/src/ch/asynk/gdx/board/test/GameHud.java
+++ b/test/src/ch/asynk/gdx/board/test/GameHud.java
@@ -75,7 +75,7 @@ public class GameHud implements Disposable, Touchable
updateNext(0, Alignment.BOTTOM_RIGHT);
this.root.remove(this.hello);
break;
- case HEX_H:
+ default:
break;
}
}
@@ -94,9 +94,7 @@ public class GameHud implements Disposable, Touchable
drawButtons(batch);
drawCorners(batch);
break;
- case HEX_V:
- case HEX_H:
- case SQUARE:
+ default:
drawRoot(batch);
break;
}
diff --git a/test/src/ch/asynk/gdx/board/test/GameScreen.java b/test/src/ch/asynk/gdx/board/test/GameScreen.java
index 63f9394..984ef5e 100644
--- a/test/src/ch/asynk/gdx/board/test/GameScreen.java
+++ b/test/src/ch/asynk/gdx/board/test/GameScreen.java
@@ -40,7 +40,7 @@ public class GameScreen implements Screen
public enum State
{
- UI, HEX_V, HEX_H, SQUARE;
+ UI, HEX_V, HEX_H, SQUARE, TRI_H, TRI_V;
public State next()
{
switch(this) {
@@ -51,6 +51,10 @@ public class GameScreen implements Screen
case HEX_H:
return SQUARE;
case SQUARE:
+ return TRI_H;
+ case TRI_H:
+ return TRI_V;
+ case TRI_V:
return UI;
default:
return UI;