File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ struct ColonyRenderer
130130
131131 const float margin = 10 .0f ;
132132 const sf::Vector2f size (400 .0f , 100 .0f );
133- const float colonies_count = 4 .0f ;
133+ const float colonies_count = 2 .0f ;
134134 const float start_x = (Conf::WIN_WIDTH - size.x * colonies_count - (colonies_count - 1 .0f ) * margin) * 0 .5f ;
135135 population.configure ({start_x + (size.x + margin) * colony.id , margin}, size);
136136 population.population .color = colony.ants_color ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ struct Colony
3636 , id(col_id)
3737 {
3838 base.food = 0 .0f ;
39- uint32_t ants_count = 2000 ;
39+ uint32_t ants_count = 16 ;
4040 for (uint32_t i (ants_count); i--;) {
4141 createWorker ();
4242 }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ int main()
2121 simulation.createColony (margin, margin);
2222 simulation.createColony (Conf::WORLD_WIDTH - margin, Conf::WORLD_HEIGHT - margin);
2323 simulation.loadMap (" res/map.png" );
24+ simulation.renderer .vp_handler .reset ();
2425
2526 sf::Clock clock;
2627 RMean<float > fps (100 );
@@ -31,24 +32,22 @@ int main()
3132 fps_text.setCharacterSize (32 );
3233 fps_text.setFillColor (sf::Color::White);
3334 fps_text.setPosition (10 .0f , 10 .0f );
35+ const float dt = 0 .016f ;
3436
35- while (window.isOpen ())
36- {
37+ while (window.isOpen ()) {
38+ // Update simulation
3739 simulation.processEvents ();
38-
39- const float dt = 0 .016f ;
4040 simulation.update (dt);
41-
41+ // Update FPS metric
4242 fps_text.setString (toStr (fps.get ()));
43-
43+ // Render simulation
4444 window.clear (sf::Color (94 , 87 , 87 ));
4545 simulation.render (window);
4646 window.draw (fps_text);
4747 window.display ();
48-
48+ // Add render time to the counter
4949 fps.addValue (1 .0f / clock.restart ().asSeconds ());
5050 }
51-
5251 // Free textures
5352 Conf::freeTextures ();
5453
You can’t perform that action at this time.
0 commit comments