This repository has been archived by the owner on Nov 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelpMenu.cpp
58 lines (52 loc) · 1.53 KB
/
HelpMenu.cpp
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
#include "HelpMenu.hpp"
#include <SFML/Graphics.hpp>
HelpMenu::HelpMenu(void)
{
bgTexture.loadFromFile("assets/menus/mainmenu.jpg");
Background.setTexture(bgTexture);
Background.setColor(sf::Color(128, 128, 128, 250));
ButtonFont.loadFromFile("assets/ChillerStdRegular.otf");
TitleFont.loadFromFile("assets/InformalRoman.ttf");
Running = true;
}
int HelpMenu::Run(sf::RenderWindow &App)
{
while (Running)
{
//Verifying events
while (App.pollEvent(Event))
{
// Window closed
if (Event.type == sf::Event::Closed)
{
return (-1);
}
//Key pressed
if (Event.type == sf::Event::KeyPressed)
{
switch (Event.key.code)
{
case sf::Keyboard::Escape:
return (0);
break;
}
}
}
Title.setCharacterSize(58);
Title.setString("Haunted Piñatas");
Title.setFillColor(sf::Color::White);
Title.setFont(TitleFont);
Title.setPosition(sf::Vector2f((App.getSize().x / 2) - (Title.getLocalBounds().width / 2),
80
));
//Clearing screen
App.clear(sf::Color(0, 0, 0, 0));
//Drawing
App.draw(Background);
App.draw(Title);
App.draw(Text);
App.display();
}
//Never reaching this point normally, but just in case, exit the application
return -1;
}