@@ -32,10 +32,8 @@ int main()
3232 sf::RenderWindow window (sf::VideoMode (Conf::WIN_WIDTH, Conf::WIN_HEIGHT), " AntSim" , sf::Style::Fullscreen, settings);
3333 window.setFramerateLimit (60 );
3434
35- Conf::loadTextures ();
36-
3735 World world (Conf::WIN_WIDTH, Conf::WIN_HEIGHT);
38- Colony colony (Conf::COLONY_POSITION.x , Conf::COLONY_POSITION.y , 1024 );
36+ Colony colony (Conf::COLONY_POSITION.x , Conf::COLONY_POSITION.y , Conf::ANTS_COUNT );
3937 // Colony colony(250, 250, 512);
4038 for (uint32_t i (0 ); i < 64 ; ++i) {
4139 float angle = float (i) / 64 .0f * (2 .0f * PI);
@@ -47,14 +45,16 @@ int main()
4745 sf::Vector2f last_clic;
4846
4947 sf::Image wall_map;
50- wall_map.loadFromFile (" map.bmp" );
51- for (uint32_t x (0 ); x < wall_map.getSize ().x ; ++x) {
52- for (uint32_t y (0 ); y < wall_map.getSize ().y ; ++y) {
53- const sf::Vector2f position = float (world.grid_walls .cell_size ) * sf::Vector2f (x, y);
54- if (wall_map.getPixel (x, y).r > 50 ) {
55- world.addWall (position);
56- } else if (wall_map.getPixel (x, y).g > 100 ) {
57- world.addFoodAt (position.x , position.y , 5 .0f );
48+ if (wall_map.loadFromFile (" map.bmp" )) {
49+ for (uint32_t x (0 ); x < wall_map.getSize ().x ; ++x) {
50+ for (uint32_t y (0 ); y < wall_map.getSize ().y ; ++y) {
51+ const sf::Vector2f position = float (world.grid_walls .cell_size ) * sf::Vector2f (x, y);
52+ if (wall_map.getPixel (x, y).r > 50 ) {
53+ world.addWall (position);
54+ }
55+ else if (wall_map.getPixel (x, y).g > 100 ) {
56+ world.addFoodAt (position.x , position.y , 5 .0f );
57+ }
5858 }
5959 }
6060 }
0 commit comments