-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (23 loc) · 759 Bytes
/
main.cpp
File metadata and controls
33 lines (23 loc) · 759 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
#include "Simulation.hpp"
#include <cstdlib> // needed for rand() and srand()
#include <ctime> // needed for time()
int main()
{
// Seed the random number generator with the current time
srand(time(nullptr));
sf::RenderWindow window(sf::VideoMode(1920, 1080), "SFML works!");
window.setPosition(sf::Vector2i(0,0)); // start window pos
Simulation simulation(window);
sf::Clock clock; // create a clock object to measure elapsed time
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
simulation.run(clock.restart().asSeconds());
}
return 0;
}