-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameManager.h
82 lines (68 loc) · 2.01 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef GameManager_h
#define GameManager_h
#include <SFML/Window.hpp>
#include "Screen.h"
#include "Grid.h"
#include "Leaderboard.h"
#include "SoundManager.h"
#include "CustomOptions.h"
#include "TextBox.h"
#include "SelectBox.h"
class ManagerManager;
class GameManager : public Screen
{
public:
GameManager(RenderWindow& window_ref, ManagerManager& manager_ref, SoundManager& soundManager_ref,Leaderboard & _leaderboard_ref);
enum State {difficultySelection,customSelection, playing, finished};
void setState(State state) { this->state = state; }
State getState(){return state;}
virtual void update(); // from Screen
virtual void manageInput(Keyboard::Key key); //from Screen
virtual void manageInput(Mouse::Button button, bool released = 0); //from Screen
virtual void updateMouse(); //from screen
void pushChar(char input);
void startTimer();
void stopTimer();
protected:
virtual void drawSelected(); //from screen
private:
State state = State::difficultySelection;
SoundManager& soundManager_ref;
Leaderboard& leaderboard_ref;
Text options[5];
IntRect optionBoxes[5];
SelectBox selectBoxes[5];
short int selectedFontSize = 48;
enum Difficulty { easy, medium, hard, custom};
Difficulty difficulty = Difficulty::easy;
void setDifficulty(Difficulty difficulty) { this->difficulty = difficulty; }
void setDifficulty(short int difficulty) { this->difficulty = static_cast<Difficulty>(difficulty); }
void drawDifficulty();
void drawGame();
void drawTimer();
void drawBombCount();
void drawRestart();
void drawGameOver();
void drawBack();
string timeToString(Time t);
void checkClick();
void reset(bool isHighScore = false);
void startGame();
Clock timer;
Time score;
bool won;
bool hasHighScore;
bool timerStarted;
Text result;
Text highScoreMessage;
Text back;
RectangleShape resultFrame;
TextBox highScoreName;
RectangleShape arrow;
Texture arrowTexture;
Texture redArrowTexture;
CustomOptions customOptions;
Grid grid;
void setGrid();
};
#endif // !GameManager_h