ajouté classe Menu
This commit is contained in:
46
src/Core/Menu.cpp
Normal file
46
src/Core/Menu.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "Menu.h"
|
||||
|
||||
#include "PiecesList.h"
|
||||
#include "Player.h"
|
||||
#include "Game.h"
|
||||
|
||||
|
||||
Menu::Menu() {
|
||||
// default board size
|
||||
this->boardHeight = 20;
|
||||
this->boardWidth = 10;
|
||||
}
|
||||
|
||||
Game Menu::startGame(Gamemode gamemode) {
|
||||
return Game(gamemode, this->playerControls, this->boardWidth, this->boardHeight, std::make_shared<PiecesList>(this->piecesList));
|
||||
}
|
||||
|
||||
bool Menu::setBoardWidth(int width) {
|
||||
if (width < 1) return false;
|
||||
|
||||
this->boardWidth = width;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Menu::setBoardHeight(int height) {
|
||||
if (height < 1) return false;
|
||||
|
||||
this->boardHeight = height;
|
||||
return true;
|
||||
}
|
||||
|
||||
int Menu::getBoardWidth() {
|
||||
return this->boardWidth;
|
||||
}
|
||||
|
||||
int Menu::getBoardHeight() {
|
||||
return this->boardHeight;
|
||||
}
|
||||
|
||||
Player& Menu::getPlayerControls() {
|
||||
return this->playerControls;
|
||||
}
|
||||
|
||||
PiecesList& Menu::getPiecesList() {
|
||||
return this->piecesList;
|
||||
}
|
||||
Reference in New Issue
Block a user