blob: 8efb2aade87352143e4f9a8295c8d56542cff250 (
plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
core/entity.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2.
*/
#ifndef __INCLUDED_CORE_ENTITY_H__
#define __INCLUDED_CORE_ENTITY_H__
#include "core/core.h"
#include "core/player.h"
#include "math/mathlib.h"
#include <vector>
namespace core
{
namespace entity
{
/// Entity flags
enum Flags {Static=1};
/// Entity type constants
enum Type {None = 0, Dynamic = 1, Controlable = 2};
}
/// The base world entity. All gameworld entities must derive from this class.
class Entity
{
public:
/// create a new entity and add it to the registry
Entity(unsigned int entity_flags = 0, unsigned int entity_type = entity::None);
virtual ~Entity();
/// id of the entity
unsigned int id;
/// flags
unsigned int flags;
/// type
unsigned int type;
/// base shape
unsigned int base_shape;
/// base color
math::Color base_color;
/// label
std::string label;
/* updateable */
/// location of the entity
math::Vector3f location;
};
/// an entity that can move
class EntityDynamic : public Entity
{
public:
EntityDynamic(unsigned int entity_flags = 0, unsigned int entity_type=entity::Dynamic);
/* updateable */
/// speed vector, in game units / second
math::Vector3f speed;
};
/// an entity that can be controlled by a player
class EntityControlable : public EntityDynamic
{
public:
EntityControlable(unsigned int entity_flags = 0, unsigned int entity_type=entity::Controlable);
/// owner of this controllable entity
Player *owner;
};
namespace entity
{
/// base entity shapes
enum Shapes {Diamond=0, Cube=1, Sphere=2};
/// the entity registry
extern std::vector<Entity*> registry;
/// add an entity to the registry
void add(Entity *ent);
/// clear the entity registry
void clear();
/// list the entity registry
void list();
}
}
#endif // __INCLUDED_CORE_ENTITY_H__
|