Skip to content

Commit

Permalink
Add conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
johnBuffer committed Apr 2, 2021
1 parent 0c32adb commit 153d9f1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
#include <SFML/Graphics.hpp>
#include <vector>
#include <list>
#include <fstream>
#include "colony.hpp"
#include "config.hpp"
#include "display_manager.hpp"


uint32_t loadUserConf()
{
uint32_t ants_count = 512;
std::ifstream conf_file("conf.txt");
if (conf_file) {
conf_file >> ants_count;
}
else {
std::cout << "Couldn't find 'conf.txt', loading default" << std::endl;
}

return ants_count;
}


int main()
{
sf::ContextSettings settings;
Expand All @@ -14,9 +30,10 @@ int main()
window.setFramerateLimit(60);

Conf::loadTextures();
const uint32_t ants_count = loadUserConf();

World world(Conf::WIN_WIDTH, Conf::WIN_HEIGHT);
Colony colony(Conf::WIN_WIDTH/2, Conf::WIN_HEIGHT/2, 512);
Colony colony(Conf::WIN_WIDTH/2, Conf::WIN_HEIGHT/2, ants_count);
world.addMarker(Marker(colony.position, Marker::ToHome, 10.0f, true));

DisplayManager display_manager(window, window, world, colony);
Expand Down

0 comments on commit 153d9f1

Please sign in to comment.