Skip to content

Commit 2c090aa

Browse files
committed
Fix conf
1 parent 058571d commit 2c090aa

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

include/config.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ uint32_t Conf::WIN_WIDTH = 1920;
4949
uint32_t Conf::WIN_HEIGHT = 1080;
5050
uint32_t Conf::ANTS_COUNT = 1024;
5151
float Conf::COLONY_SIZE = 20.0f;
52-
//sf::Vector2f Conf::COLONY_POSITION = sf::Vector2f(Conf::WIN_WIDTH * 0.5f, Conf::WIN_HEIGHT * 0.5f);
53-
sf::Vector2f Conf::COLONY_POSITION = sf::Vector2f(100.0f, 100.0f);
52+
sf::Vector2f Conf::COLONY_POSITION = sf::Vector2f(Conf::WIN_WIDTH * 0.5f, Conf::WIN_HEIGHT * 0.5f);
53+
//sf::Vector2f Conf::COLONY_POSITION = sf::Vector2f(100.0f, 100.0f);
5454

5555
std::shared_ptr<sf::Texture> Conf::ANT_TEXTURE;
5656
std::shared_ptr<sf::Texture> Conf::MARKER_TEXTURE;

src/display_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DisplayManager::DisplayManager(sf::RenderTarget& target, sf::RenderWindow& windo
1515
, m_colony(colony)
1616
, clic(false)
1717
, m_mouse_button_pressed(false)
18-
, pause(true)
18+
, pause(false)
1919
, draw_markers(true)
2020
, wall_mode(false)
2121
, render_ants(true)

src/main.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)