forked from GuillemFP/DoubleDragon3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entity.h
74 lines (55 loc) · 1.33 KB
/
Entity.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
#ifndef ENTITY_H
#define ENTITY_H
#include <list>
#include "SDL/include/SDL_rect.h"
#include "Timer.h"
#include "Globals.h"
#include "ModuleStages.h"
struct SDL_Texture;
enum update_status;
struct Collider;
class Entity
{
public:
enum Type
{
ROOM,
PLAYER,
ENEMY,
OBJECT,
UNKNOWN
};
public:
Entity(Entity::Type type, SDL_Texture* texture, ModuleStages* stage, Entity* parent = nullptr, bool active = true);
virtual ~Entity() { RELEASE(timer); }
virtual update_status PreUpdate() { return UPDATE_CONTINUE; }
virtual update_status Update();
virtual bool Draw();
virtual bool Enable();
virtual bool Disable();
virtual bool Delete();
void EnableCollider();
void DisableCollider();
bool ColliderIsActive() const;
void SetCollider(const SDL_Rect& rect);
virtual void HasCollided(Collider* with) {}
virtual void ChangeParent(Entity* new_parent);
public:
Point3d position = { 0,0,0 };
Point3d dimensions = { 0,0,0 };
Type type = UNKNOWN;
bool active = true;
bool to_delete = false;
std::list<Entity*> contains;
SDL_Texture* texture = nullptr;
SDL_Rect entity_rect = { 0,0,0,0 };
bool inverted_texture = false;
Timer* timer = nullptr;
bool has_timer = false;
Entity* parent = nullptr;
ModuleStages* stage = nullptr;
iPoint shifted_draw = { 0,0 };
protected:
Collider* collider = nullptr;
};
#endif // !ENTITY_H