-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.h
69 lines (50 loc) · 1.93 KB
/
Menu.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
#ifndef MENU_H
#define MENU_H
#include <array>
class Menu
{
public:
Menu();
~Menu();
void draw(sf::RenderWindow&);
void changeColorWhenHovered(); /// change the color of a text when hovered using processColorOfTextHovered()
void changeStateWhenClicked(); /// update menu when a text if clicked
enum state { DEFAULT, START, DIFFICULTY, SPEED, EXIT, EXITED, PAUSED, GAMEOVER, NONESTATE };
void setMenuState(const state);
state getMenuState();
state getPreviousMenuState(); void setMousePosition(const sf::Vector2i&); /// setter of mousePosition
void setScoreText(int); /// setter of score text
protected:
private:
void changeQuitPosition(); /// quit text is used in paused and gameover
bool isHovered(sf::Text&); /// check if mouse is hovering to a text
bool processColorOfTextHovered(sf::Text&); /// check if mouse is hovering to a text using isHovered() then update the color of text
state menuState;
state previousMenuState;
/// main menu
sf::Text start;
sf::Text difficulty;
sf::Text speed;
sf::Text exit;
/// when started
sf::Text pressanykeytostart;
/// difficulty
sf::Text easy;
sf::Text hard;
/// are you sure you want to exit the game
sf::Text areyousureyouwanttotexit;
sf::Text yes;
sf::Text no;
/// when paused
sf::Text resume;
/// when the game is over
sf::Text gameover;
sf::Text restart;
sf::Text quit; /// when paused or game is over
sf::Text score; /// score of game
/// for choosing speed
std::array<sf::Text,3> speedLevels;
sf::Vector2i mousePosition; ///relative to window
sf::Font defaultFont; /// default font of text
};
#endif // MENU_H