/* 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 namespace core { namespace entity { /// Entity flags enum Flags {Static=1, Solid=2}; /// Entity type constants enum Type {Default = 0, Dynamic = 1, Controlable = 2}; /// Entity shaoe constants enum Shape {Diamond=0, Sphere=1, Cube=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::Default); virtual ~Entity(); /// id of the entity unsigned int id; /// flags unsigned int flags; /// type unsigned int type; /// base shape entity::Shape base_shape; /// base color math::Color base_color; /// base radius float base_radius; /// 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 { /// the entity registry extern std::vector 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__