forked from GuillemFP/DoubleDragon3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleEntities.h
69 lines (53 loc) · 1.69 KB
/
ModuleEntities.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
#ifndef MODULEENTITIES_H
#define MODULEENTITIES_H
#include "Module.h"
#include "Entity.h"
#include "ModuleStages.h"
#include <list>
#define MODULE_ENTITIES "ModuleEntities"
#define ENTITY_SECTION "Config.Entities.Globals"
#define ENTITY_PLAYER1 "Config.Entities.Player1"
#define ENTITY_PLAYER2 "Config.Entities.Player2"
struct SDL_Texture;
class Player;
class Timer;
class ModuleEntities : public Module
{
public:
struct CompareDepth {
bool operator()(Entity* lhs, Entity* rhs) { return lhs->position.z < rhs->position.z; }
};
ModuleEntities();
~ModuleEntities();
bool Start();
update_status PreUpdate();
update_status Update();
bool CleanUp();
Entity* CreateEntity(Entity::Type type, SDL_Texture* texture, const char* name, ModuleStages* stage, Entity* parent = nullptr);
unsigned int GetSound(int num_table) const { return sounds[num_table]; }
int GetNumberCoins() const { return coins; }
Player* GetTargetPlayer(Entity* entity) const;
void ResetCoins() { coins = initial_coins; }
void SpendCoin() { --coins; }
Player* GetPlayerByNumber(int player_num) const;
Player* GetAnActivePlayer() const;
int GetNumberPlayers() const { return num_players; }
int GetNumberActivePlayers() const;
float DistanceBetweenEntities(const Entity* first, const Entity* second) const;
float Distance2D(int x1, int z1, int x2, int z2) const;
public:
SDL_Texture* players = nullptr;
SDL_Texture* enemies = nullptr;
SDL_Texture* faces = nullptr;
SDL_Texture* signals = nullptr;
Timer* stage_timer;
Timer* continue_timer;
private:
std::list<Entity*> entities;
unsigned int* sounds = nullptr;
int num_players = 0;
int coins = 0;
int initial_coins = 10;
int iMAX_PLAYERS = 1;
};
#endif // !MODULEENTITIES_H