Commit 90e3681b authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

BoardImage passed as parameter to PlayView, imagepath collected from AbstractBoard

parent 25f4b9d5
......@@ -23,7 +23,7 @@ public class NetworkController {
this.client = new Client();
client.start();
try {
String IP4_LAN_ADDRESS = "192.168.0.109";
String IP4_LAN_ADDRESS = "192.168.0.136";
client.connect(10000, IP4_LAN_ADDRESS, 54555);
} catch (IOException e) {
......
......@@ -140,4 +140,8 @@ class Game(gameState: GameState, playerIds: LinkedHashSet<Int>) {
fun getPlayerIds(): LinkedHashSet<Int> {
return playerIds
}
fun getBoardImagePath(): String {
return this.gameState.getBoardState().getBoardImagePath()
}
}
......@@ -10,4 +10,5 @@ abstract class AbstractBoard {
abstract fun fieldExists(coordinates: Vector3): Boolean // Returns whether a field exists on board
abstract fun placePiecesAtStart(rules: AbstractRules, playerIds: HashSet<Int>) // Places pieces at startfields
abstract fun movePiece(fromCoordinates: Vector3, toCoordinates: Vector3): Boolean // Moves piece
abstract fun getBoardImagePath(): String // Returns path to board image
}
\ No newline at end of file
......@@ -77,4 +77,8 @@ class DefaultBoard: AbstractBoard() {
}
return true
}
override fun getBoardImagePath(): String {
return "Game/1x/GameBoard@1x.png"
}
}
\ No newline at end of file
......@@ -264,7 +264,7 @@ public class CinematicView extends AbstractView {
// Initialize model and set PlayView
Game model = new Game(new GameState(new GameMode(new DefaultRules(), new DefaultBoard())), playerController.getLobby().getPlayersID());
PlayView playView = new PlayView(gvm, playerController, assetManager, stage, skin, lobbyAvatars);
PlayView playView = new PlayView(gvm, playerController, assetManager, stage, skin, lobbyAvatars, model.getBoardImagePath());
GameController gameController = new GameController(model, playView, playerController);
playerController.setGameController(gameController);
playView.setGameController(gameController);
......
......@@ -59,7 +59,7 @@ public class PlayView extends AbstractView {
float scale_factor_piece;
public float hex_side_length;
public PlayView(GameViewManager gvm, PlayerController playerController, AssetManager assetManager, Stage stage, Skin skin, ArrayList<AnimatedSprite> lobbyAvatars) {
public PlayView(GameViewManager gvm, PlayerController playerController, AssetManager assetManager, Stage stage, Skin skin, ArrayList<AnimatedSprite> lobbyAvatars, String boardImagePath) {
super(gvm, playerController, assetManager, stage, skin);
stage.getCamera().position.set(Gdx.graphics.getWidth() / 2F, Gdx.graphics.getHeight() / 2F, 0);
......@@ -72,7 +72,7 @@ public class PlayView extends AbstractView {
stage.addActor(backgroundImage);
// Create board image
Texture board = new Texture("Game/1x/GameBoard@1x.png");
Texture board = new Texture(boardImagePath);
boardImage = new Image(board);
// Calculate scale factors for board and pieces, and corresponding hex side length
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment