-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.hpp
77 lines (54 loc) · 1.87 KB
/
Game.hpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef GAME_H
#define GAME_H
#define PI 3.14159265358979323846
#include <list>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include "TowerManager.hpp"
#include "Tower.hpp"
#include "Enemy.hpp"
#include "Entity.hpp"
#include "Vec.hpp"
namespace Game{
namespace Stats{
extern unsigned int enemiesKilled;
}
enum TileType{
EmptyTile,
TowerTile,
RoadTile
};
extern std::unique_ptr<TowerManager> towerManager;
extern std::list<std::unique_ptr<Tower>> towers;
extern std::list<std::unique_ptr<Enemy>> enemies;
extern std::list<std::unique_ptr<Entity>> entities;
extern std::vector<Vec2i> enemiesRoute;
extern std::vector< std::vector<TileType> > map;
extern int pixelsPerSquare;
extern double life;
extern int money;
extern int tickCount;
extern int velocity;
extern Tower* selectedTower;
bool tick();
void draw(sf::RenderWindow* window);
/// HELPERS
Tower* getTower(Vec2i position);
bool putTower(std::unique_ptr<Tower>& tower);
std::list<Tower*>::iterator removeTower(std::list<Tower*>::iterator tower);
boolean removeTower(Vec2i position);
bool isInRange(Vec2d position, double minRange, double maxRange, Enemy* enemy);
std::list<std::unique_ptr<Enemy>>::iterator kill(std::list<std::unique_ptr<Enemy>>::iterator enemy);
std::list<std::unique_ptr<Enemy>>::iterator findTarget(Tower* tower);
std::list< std::list<std::unique_ptr<Enemy>>::iterator > findEnemiesInRange(Vec2d position, double minRange, double maxRange);
bool exists(Enemy* enemy);
bool exists(Tower* tower);
bool exists(Entity* entities);
void clearTowers();
void clearEntities();
void clearEnemies();
void killEnemies();
double getDistance(Vec2i towerPosition, Vec2d position);
Vec2d getRealPosition(Vec2i towerPosition);
}
#endif // GAME_H