smarter & pointier
This commit is contained in:
@@ -4,15 +4,19 @@
|
||||
#include "Player.h"
|
||||
#include "Game.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
Menu::Menu() {
|
||||
this->piecesList = std::make_shared<PiecesList>(PiecesList());
|
||||
|
||||
// default board size
|
||||
this->boardHeight = 20;
|
||||
this->boardWidth = 10;
|
||||
}
|
||||
|
||||
Game Menu::startGame(Gamemode gamemode) const {
|
||||
return Game(gamemode, this->playerControls, this->boardWidth, this->boardHeight, std::make_shared<PiecesList>(this->piecesList));
|
||||
return Game(gamemode, this->playerControls, this->boardWidth, this->boardHeight, this->piecesList);
|
||||
}
|
||||
|
||||
bool Menu::setBoardWidth(int width) {
|
||||
@@ -42,5 +46,5 @@ Player& Menu::getPlayerControls() {
|
||||
}
|
||||
|
||||
PiecesList& Menu::getPiecesList() {
|
||||
return this->piecesList;
|
||||
return *this->piecesList;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ static const int FRAMES_PER_SECOND = 60; // the number of frames per second, all
|
||||
*/
|
||||
class Menu {
|
||||
private:
|
||||
PiecesList piecesList; // the list of pieces in the game
|
||||
Player playerControls; // the controls of the player
|
||||
int boardWidth; // the width of the board for the next game
|
||||
int boardHeight; // the height of the board for the next game
|
||||
std::shared_ptr<PiecesList> piecesList; // the list of pieces in the game
|
||||
Player playerControls; // the controls of the player
|
||||
int boardWidth; // the width of the board for the next game
|
||||
int boardHeight; // the height of the board for the next game
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user