ajouté classe Menu

This commit is contained in:
2025-03-01 20:27:36 +01:00
parent d443b25de1
commit 8088894073
11 changed files with 136 additions and 48 deletions

46
src/Core/Menu.cpp Normal file
View 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;
}