-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameplay.h
88 lines (60 loc) · 1.69 KB
/
Gameplay.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef _GAMEPLAY_H
#define _GAMEPLAY_H
#include <vector>
#include "Level.h"
#include "Player.h"
#include "NPC.h"
#include "PauseMenu.h"
#include "GameplayObject.h"
class Gameplay {
public:
Gameplay();
~Gameplay();
static int frame;
static Gameplay * instance;
Level * level;
std::vector<Player*> * players;
std::vector<NPC*> * npcs;
std::vector<GameplayObject*> * objects;
void run();
void set_level(Level * level);
void add_player(Player * player);
void add_npc(NPC * npc);
void add_object(GameplayObject * obj);
void bounce_up_players_and_npcs(SDL_Rect * rect, SDL_Rect * source);
static bool is_intersecting(SDL_Rect * one, SDL_Rect * two);
protected:
virtual void initialize();
virtual void deinitialize();
void reset_game();
virtual void pause(Player * p);
void process_countdown();
virtual void draw_pause_screen();
virtual void draw_score();
virtual void draw_game_ended();
virtual void draw_countdown();
virtual void on_game_reset() = 0;
virtual void on_pre_processing() = 0;
virtual void on_post_processing() = 0;
void process_player_collission();
void process_npc_collission();
void process_player_npc_collission();
void handle_pause_input(SDL_Event * event);
bool game_running;
PauseMenu * pause_menu;
bool countdown;
int countdown_sec_left;
int countdown_start;
char countdown_pre_text[20];
bool ended;
int end_start;
bool music_playing;
SDL_Surface * screen;
// Do players collide with each other?
bool players_collide;
// Do NPC's collide with each other?
bool npcs_collide;
// Do players collide with NPC's?
bool players_npcs_collide;
};
#endif