-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.cpp
35 lines (27 loc) · 811 Bytes
/
App.cpp
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
//
// Created by Artem Novikov on 15.09.2022.
//
#include "App.h"
#include <vector>
int Width = 300;
int Height = 300;
std::vector<FoodSource> food =
{FoodSource(Vector2f(150, 150), 10000)};
std::vector<std::vector<Hive>> hives = {{Hive(Vector2f(100, 100), 100)}, {Hive(Vector2f(200, 200), 100)}};
App::App() : window_(sf::VideoMode(Width * Renderer::UnitLength, Height * Renderer::UnitLength), "Ants"),
renderer_(window_, {Width, Height}),
world_({Width, Height}, food, hives) {}
void App::Run() {
while (window_.isOpen()) {
sf::Event event;
while (window_.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window_.close();
}
}
window_.clear();
renderer_.Render(world_);
window_.display();
world_.Update();
}
}