-
Notifications
You must be signed in to change notification settings - Fork 305
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (38 loc) · 1.22 KB
/
Copy pathmain.cpp
File metadata and controls
42 lines (38 loc) · 1.22 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
#include <SFML/Graphics.hpp>
#include <list>
#include <fstream>
#include "simulation/config.hpp"
#include "simulation/world/distance_field_builder.hpp"
#include "simulation/simulation.hpp"
#include "editor/editor_scene.hpp"
int main()
{
// Load configuration
if (Conf::loadUserConf()) {
std::cout << "Configuration file loaded." << std::endl;
} else {
std::cout << "Configuration file couldn't be found." << std::endl;
}
RNGf::initialize();
sf::ContextSettings settings;
settings.antiAliasingLevel = 4;
uint32_t window_style = Conf::USE_FULLSCREEN ? sf::Style::Default : sf::Style::Default;
std::string title = "AntSim";
sf::RenderWindow window(sf::VideoMode({Conf::WIN_WIDTH, Conf::WIN_HEIGHT}), title, window_style, sf::State::Windowed, settings);
window.setFramerateLimit(60);
// Initialize simulation
Simulation simulation(window);
// Create editor scene around it
GUI::Scene::Ptr scene = create<edtr::EditorScene>(window, simulation);
scene->resize();
// Main loop
while (window.isOpen()) {
// Update
scene->update();
// Render
window.clear(sf::Color(100, 100, 100));
scene->render();
window.display();
}
return 0;
}