-
Notifications
You must be signed in to change notification settings - Fork 2
/
aboutMenu.cpp
49 lines (40 loc) · 1.36 KB
/
aboutMenu.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
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include "aboutMenu.h"
aboutMenu::aboutMenu() {
drawAll draw;
}
string aboutMenu::drawAboutMenu(sf::RenderWindow& window, sf::Texture texBg) {
text = draw.drawTextAbout(window);
back = draw.getSpriteBack(window);
backWithMouse = draw.getSpriteBackWithMouse(window);
sprite.setTexture(texBg);
sprite.setScale(window.getSize().x / sprite.getGlobalBounds().width, window.getSize().y / sprite.getGlobalBounds().height);
if (sprite.getGlobalBounds().width < window.getSize().x * 0.8f || sprite.getGlobalBounds().width > window.getSize().x * 1.2f)
sprite.setScale(window.getSize().x / sprite.getGlobalBounds().width, window.getSize().y / sprite.getGlobalBounds().height);
while (true) {
menuNum = 0;
if (sf::IntRect(window.getSize().x * 0.05f - (draw.xAb / 10.0f), window.getSize().y * 0.88f - (draw.xAb / 10.0f), window.getSize().x / 13.0f, window.getSize().x / 13.0f).contains(sf::Mouse::getPosition(window))) {
menuNum = 1;
}
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
if (menuNum == 1)
break;
}
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
break;
}
}
window.draw(sprite);
window.draw(text);
window.draw(back);
if (menuNum == 1) {
window.draw(backWithMouse);
}
window.display();
}
return "main";
}