-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (36 loc) · 1.29 KB
/
main.cpp
File metadata and controls
47 lines (36 loc) · 1.29 KB
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
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include "renderer.h"
#include "solver.h"
int main()
{
constexpr int32_t window_width = 1000;
constexpr int32_t window_height = 1000;
const uint32_t frame_rate = 60;
sf::ContextSettings settings;
settings.antialiasingLevel = 1;
sf::RenderWindow window(sf::VideoMode(window_width, window_height), "Liquid Simulation", sf::Style::Default, settings);
window.setFramerateLimit(frame_rate);
Solver solver;
Renderer renderer(window);
// Particle particle = solver.addParticle(sf::Vector2f(0.0f, 0.0f), sf::Vector2f(1000.0f,500.0f));
for (uint32_t i = 0; i < 10; i++) {
for (uint32_t j = 0; j < 10; j++) {
solver.addParticle(sf::Vector2f(i-5, j-5), sf::Vector2f(1000.0f, 500.0f), 10.0f);
}
}
sf::Clock clock;
while (window.isOpen()) {
sf::Event event{};
while (window.pollEvent(event)) {
// terminate the window
if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) window.close();
}
solver.update(clock.restart().asSeconds());
window.clear(sf::Color::Black);
renderer.render(solver);
window.display();
}
std::cout << "here" << std::endl;
}