-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.h
53 lines (37 loc) · 1.09 KB
/
Application.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Created by Balajanovski on 18/11/2017.
//
#ifndef LANGTON_APPLICATION_H
#define LANGTON_APPLICATION_H
#include <memory>
#include <unordered_set>
#include <string>
#include "AntManager.h"
#include "Field.h"
#include "Drawer.h"
#include "ConfigManager.h"
#include "Util/Tile.h"
enum class ApplicationState {
PAUSED = 0,
RUNNING = 1,
STOPPED = 2,
};
class Application {
private:
static constexpr int MS_PER_UPDATE = 3;
// A set of coords denoting turned on tiles on the field to make drawing quicker
// This set is shared with
// - Field class, which adds turned on tiles to the set, and removes turned off tiles
// - Drawer class, which draws turned on tiles
std::shared_ptr< std::unordered_set< Tile > > m_colored_tiles;
AntManager m_manager;
std::shared_ptr<Field> m_field;
std::shared_ptr<Drawer> m_drawer;
void check_keyboard_events();
ApplicationState m_state = ApplicationState::STOPPED;
public:
Application(const std::string& config_path);
void begin();
void end();
};
#endif //LANGTON_APPLICATION_H