-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
42 lines (31 loc) · 860 Bytes
/
main.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
#include <SFML/Graphics.hpp>
#include "Breaker.hpp"
#include "Brick.hpp"
#include "constants.hpp"
int main(int argc, char* argv[])
{
Breaker breaker;
sf::Vector2u window_size(breaker.window_size);
sf::RenderWindow window(sf::VideoMode(window_size.x, window_size.y),
"Breaker");
sf::View view(window.getDefaultView());
while (!breaker.isFinished()) {
sf::Event event;
while (window.pollEvent(event)) {
breaker.handleEvents(event);
}
if (breaker.window_size != window_size) {
window_size = breaker.window_size;
view.setSize(window_size.x, window_size.y);
view.setCenter(window_size.x/2., window_size.y/2.);
window.setView(view);
window.setSize(window_size);
}
breaker.update();
window.clear(sf::Color::Black);
breaker.render(window);
window.display();
sf::sleep(sf::milliseconds(3));
}
return 0;
}