-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
67 lines (52 loc) · 1.57 KB
/
game.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
namespace Tmpl8
{
//forward declarations
class Tank;
class Rocket;
class Smoke;
class Particle_beam;
class Game
{
public:
void set_target(Surface* surface) { screen = surface; }
void init();
void shutdown();
void update(float deltaTime);
void draw();
void tick(float deltaTime);
void insertion_sort_tanks_health(const std::vector<Tank>& original, std::vector<const Tank*>& sorted_tanks, int begin, int end);
void draw_health_bars(const std::vector<const Tank*>& sorted_tanks, const int team);
void measure_performance();
Tank& find_closest_enemy(Tank& current_tank);
void mouse_up(int button)
{ /* implement if you want to detect mouse button presses */
}
void mouse_down(int button)
{ /* implement if you want to detect mouse button presses */
}
void mouse_move(int x, int y)
{ /* implement if you want to detect mouse movement */
}
void key_up(int key)
{ /* implement if you want to handle keys */
}
void key_down(int key)
{ /* implement if you want to handle keys */
}
private:
Surface* screen;
vector<Tank> tanks;
vector<Rocket> rockets;
vector<Smoke> smokes;
vector<Explosion> explosions;
vector<Particle_beam> particle_beams;
Terrain background_terrain;
std::vector<vec2> forcefield_hull;
Font* frame_count_font;
long long frame_count = 0;
bool lock_update = false;
//Checks if a point lies on the left of an arbitrary angled line
bool left_of_line(vec2 line_start, vec2 line_end, vec2 point);
};
}; // namespace Tmpl8