-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTitle.cpp
More file actions
32 lines (26 loc) · 718 Bytes
/
Title.cpp
File metadata and controls
32 lines (26 loc) · 718 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
#include "Title.h"
#include <SFML/Graphics.hpp>
Title::Title(sf::RenderWindow& win) : window(win) {}
bool Title::show() {
sf::Font font;
if (!font.loadFromFile("arial.ttf")) {
return false;
}
sf::Text text("Welcome to eMusiMath!\nPress ENTER to start", font, 30);
text.setFillColor(sf::Color::White);
text.setPosition(200, 300);
while (window.isOpen()) {
sf:: Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
if (event.type == sf::Event::Keypressed && event.key.code == sf::Keyboard::Enter) {
return true;
}
}
window.clear();
window.draw(text);
window.display();
}
return false;
}