/* 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); virtual ~Entity(); /// core type of this entity virtual inline unsigned int core_type() { return entity::Default; } /// core shape entity::Shape core_shape; /// core color math::Color core_color; /// core radius float core_radius; /// label std::string label; /// custom game type of this entity unsigned int type; /// id of the entity unsigned int id; /// flags unsigned int flags; /* updateable */ /// location of the entity math::Vector3f location; }; /// an entity that can move around in the game world class EntityDynamic : public Entity { public: EntityDynamic(unsigned int entity_flags = 0); /// core type of this entity virtual inline unsigned int core_type() { return 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); /// core type of this entity virtual inline unsigned int core_type() { return 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__