-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpauseMenu.cpp
More file actions
77 lines (60 loc) · 1.89 KB
/
Copy pathpauseMenu.cpp
File metadata and controls
77 lines (60 loc) · 1.89 KB
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
#include "pauseMenu.h"
pauseMenu::pauseMenu(Font* font)
{
string ttf("Res/Fonts/");
for (int i = 0; i < MAX_NUMBER_OF_ITEMS; i++) {
text[i].setFont(*font);
text[i].setOutlineThickness(5);
text[i].setOutlineColor(Color::Black);
text[i].setCharacterSize(70);
}
head.setFont(*font);
head.setOutlineThickness(5);
head.setOutlineColor(Color::Black);
head.setCharacterSize(90);
head.setFillColor(Color(0, 204, 0, 255));
head.setString("Pause Menu");
text[0].setFillColor(Color::Red);
text[0].setString("Continues");
text[1].setFillColor(Color(200, 200, 200, 255));
text[1].setString("Main Menu");
text[2].setFillColor(Color(200, 200, 200, 255));
text[2].setString("Exit");
bg.setFillColor(Color(190, 190, 190, 150));
bg.setSize(Vector2f(800.0f, 600.0f));
bg.setOrigin(bg.getPosition() / 2.0f);
selectedItemIndex = 0;
}
pauseMenu::~pauseMenu()
{
}
void pauseMenu::draw(RenderWindow& window)
{
window.draw(bg);
window.draw(head);
for (int i = 0; i < MAX_NUMBER_OF_ITEMS; i++) {
window.draw(text[i]);
}
}
void pauseMenu::MoveUp() {
if (selectedItemIndex - 1 >= 0) {
text[selectedItemIndex].setFillColor(Color(200, 200, 200, 255));
selectedItemIndex--;
text[selectedItemIndex].setFillColor(Color::Red);
}
}
void pauseMenu::MoveDown() {
if (selectedItemIndex + 1 < MAX_NUMBER_OF_ITEMS) {
text[selectedItemIndex].setFillColor(Color(200, 200, 200, 255));
selectedItemIndex++;
text[selectedItemIndex].setFillColor(Color::Red);
}
}
void pauseMenu::pauseActive(Vector2f pos)
{
text[0].setPosition(Vector2f(pos.x + PosX, pos.y + PosY + (0 * Gap)));
text[1].setPosition(Vector2f(pos.x + PosX, pos.y + PosY + (1 * Gap)));
text[2].setPosition(Vector2f(pos.x + PosX, pos.y + PosY + (2 * Gap)));
bg.setPosition(Vector2f(pos.x -400.0f, pos.y -400.0f));
head.setPosition(Vector2f(pos.x - 250.0f, pos.y - 350.0f));
}