-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMenu.cpp
More file actions
39 lines (30 loc) · 921 Bytes
/
Menu.cpp
File metadata and controls
39 lines (30 loc) · 921 Bytes
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
#include "src/Menu.hpp"
Menu::Menu(float width, float height)
{
if(!font.loadFromFile("assets/arial.ttf"))
{
//error
}
menu[0].setFont(font);
menu[0].setString("Play");
menu[0].setFillColor(sf::Color::Red);
menu[0].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 1));
menu[1].setFont(font);
menu[1].setFillColor(sf::Color::White);
menu[1].setString("Options");
menu[1].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 2));
menu[2].setFont(font);
menu[2].setFillColor(sf::Color::White);
menu[2].setString("Exit");
menu[2].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 3));
}
Menu::~Menu()
{
}
void Menu::draw(sf::RenderWindow &window)
{
for(int i = 0; i < MAX_NUMBER_OF_ITEMS; i++)
{
window.draw(menu[i]);
}
}