-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.h
61 lines (54 loc) · 1.57 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
#include <SFML/Graphics.hpp>
#include "Simulation.h"
#include <ostream>
#include <fstream>
using namespace sf;
// laptop scrren size
const int window_width = 1920;
const int window_height = 1050;
class Menu
{
public:
int currentOption;
Sprite background;
Texture texture;
Text statement;
sf::RenderWindow window;
Simulation s;
Menu() : window(sf::VideoMode(window_width, window_height), "girti hoi bdewar ko iek dhka aur"), s(window_width, window_height)
{
currentOption = 0;
background.setScale(static_cast<float>(window_width) / texture.getSize().x, static_cast<float>(window_height) / texture.getSize().y);
}
void display_menu()
{
Font font;
font.loadFromFile("Arial.ttf");
statement.setFont(font);
statement.setCharacterSize(50);
statement.setStyle(sf::Text::Bold);
statement.setFillColor(sf::Color::Black);
statement.setPosition(350, 350 + 100);
statement.setString("Dekhao");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
if (Keyboard::isKeyPressed(Keyboard::Enter))
Choose(window);
window.clear(sf::Color::White);
window.draw(background);
window.draw(statement);
window.display();
}
}
void Choose(RenderWindow &window)
{
if (currentOption == 0)
s.start(window);
}
};