-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameManager.h
60 lines (51 loc) · 1.79 KB
/
GameManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _GAME_MANAGER_
#define _GAME_MANAGER_
#include <memory>
#include "BoardSubject.h"
#include "CommandEngine.h"
#include "TextDisplay.h"
#include "GUIDisplay.h"
//resolve circular dependencies
class CommandEngine;
struct PImplGameManager{
//GameManager vars
std::shared_ptr<BoardSubject> board_;
std::shared_ptr<CommandEngine> command_;
unsigned int seed_;
unsigned int startLvl_;
unsigned int maxLvl_;
bool guiEnabled;
PImplGameManager();
};
class GameManager{
private:
GameManager();
//singleton glocal obj
static std::shared_ptr<GameManager> gm_;
std::shared_ptr<PImplGameManager> gameManager_;
std::shared_ptr<TextDisplay> text_;
std::shared_ptr<GUIDisplay> gui_;
//Special Member Functions
GameManager(const GameManager&) = delete; //prevent copying the class
GameManager& operator= (const GameManager&) = delete; //prevent copying the class
public:
static std::shared_ptr<GameManager> instance(); //get global GameManager instance
void startGame(); //client calls this to start a Game
void initialize(int, char**); //setup any data that can't be in ctor
void move(Direction);
void rotate(Rotation);
void levelAdjustment(LevelAdj);
void drop();
void getHint();
void setRandom(bool ran, std::string path = "");
void restart();
void specificBlock(std::string s);
void changeFloatingBlockToNextBlock();
void setSeed(unsigned int sd);
void setStartLvl(unsigned int sl);
void disableGUI();
void setDefaultFilePath(std::string);
void executePostMove();
void setMaxLvl(unsigned int lvl);
};
#endif