diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-09-13 16:40:42 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-09-13 16:40:42 +0200 |
commit | 88188156cfaf037866b5242fc1b06dd9754c2b94 (patch) | |
tree | c2cca384cd54dcda21346e3dfb4883266b5426e5 /core/src/ch/asynk/zproject/GameBoard.java | |
parent | 8dd8abf9372b35e2cc01cbad3e683d13979a1631 (diff) | |
download | gdx-boardgame-88188156cfaf037866b5242fc1b06dd9754c2b94.zip gdx-boardgame-88188156cfaf037866b5242fc1b06dd9754c2b94.tar.gz |
add SquareBoard test
Diffstat (limited to 'core/src/ch/asynk/zproject/GameBoard.java')
-rw-r--r-- | core/src/ch/asynk/zproject/GameBoard.java | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/core/src/ch/asynk/zproject/GameBoard.java b/core/src/ch/asynk/zproject/GameBoard.java index 4d3f774..b855ff2 100644 --- a/core/src/ch/asynk/zproject/GameBoard.java +++ b/core/src/ch/asynk/zproject/GameBoard.java @@ -11,7 +11,8 @@ import ch.asynk.zproject.engine.board.BoardFactory; public class GameBoard implements Disposable, Touchable { - private final Texture map; + private final Assets assets; + private Texture map; private Board board; private int dx; @@ -24,7 +25,7 @@ public class GameBoard implements Disposable, Touchable public GameBoard(final Assets assets) { - this.map = assets.getTexture(assets.MAP_00); + this.assets = assets; this.v = new Vector2(); setState(GameScreen.State.UI); } @@ -53,27 +54,43 @@ public class GameBoard implements Disposable, Touchable case HEX_H: setHEX_H(); break; + case SQUARE: + setSQUARE(); + break; } } private void setHEX_V() { + this.map = assets.getTexture(assets.MAP_00); r = 0; dx = 0; dy = 0; - w = map.getWidth(); - h = map.getHeight(); - this.board = BoardFactory.getBoard(BoardFactory.BoardType.HEX, 10, 9, 110, 50, 103, BoardFactory.BoardOrientation.VERTICAL); + w = this.map.getWidth(); + h = this.map.getHeight(); + this.board = BoardFactory.getBoard(BoardFactory.BoardType.HEX, 110, 50, 103, BoardFactory.BoardOrientation.VERTICAL); } private void setHEX_H() { + this.map = assets.getTexture(assets.MAP_00); r = 90; - dx = - ( map.getWidth() - map.getHeight() ) / 2; + dx = - ( this.map.getWidth() - this.map.getHeight() ) / 2; dy = - dx; + w = this.map.getWidth(); + h = this.map.getHeight(); + this.board = BoardFactory.getBoard(BoardFactory.BoardType.HEX, 110, 103, 50, BoardFactory.BoardOrientation.HORIZONTAL); + } + + private void setSQUARE() + { + this.map = assets.getTexture(assets.CHESS); + r = 0; + dx = 0; + dy = 0; w = map.getHeight(); h = map.getWidth(); - this.board = BoardFactory.getBoard(BoardFactory.BoardType.HEX, 9, 10, 110, 103, 50, BoardFactory.BoardOrientation.HORIZONTAL); + this.board = BoardFactory.getBoard(BoardFactory.BoardType.SQUARE, 83, 5, 5); } public int getWidth() |