From 825d5a44bd312772c53fdaa8924e4009cfb320a3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 10 Feb 2008 17:54:53 +0000 Subject: more entity updates --- src/core/entity.cc | 7 ++++++- src/core/entity.h | 17 ++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/entity.cc b/src/core/entity.cc index 7f23213..3854fd0 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -18,7 +18,12 @@ Entity::Entity(unsigned int entity_flags, unsigned int entity_type) flags = entity_flags; type = entity_type; + base_shape = entity::Diamond; + base_color = math::Color(1.0f, 1.0f, 1.0f); + base_radius = 1.0f; + core::entity::add(this); + } Entity::~Entity() @@ -86,7 +91,7 @@ void list() std::vector::iterator it; for (it=registry.begin(); it != registry.end(); it++) { con_print << " id " << std::setw(3) << (*it)->id - << " type " << std::setw(2) << (*it)->type + << " type " << std::setw(3) << (*it)->type << " " << (*it)->label << std::endl; } con_print << registry.size() << " registered entities" << std::endl; diff --git a/src/core/entity.h b/src/core/entity.h index 8efb2aa..518166b 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -19,10 +19,13 @@ namespace entity { /// Entity flags -enum Flags {Static=1}; +enum Flags {Static=1, Solid=2}; /// Entity type constants -enum Type {None = 0, Dynamic = 1, Controlable = 2}; +enum Type {Default = 0, Dynamic = 1, Controlable = 2}; + +/// Entity shaoe constants +enum Shape {Diamond=0, Sphere=1, Cube=2}; } @@ -31,7 +34,7 @@ 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); + Entity(unsigned int entity_flags = 0, unsigned int entity_type = entity::Default); virtual ~Entity(); /// id of the entity @@ -44,10 +47,13 @@ public: unsigned int type; /// base shape - unsigned int base_shape; + entity::Shape base_shape; /// base color math::Color base_color; + + /// base radius + float base_radius; /// label std::string label; @@ -84,9 +90,6 @@ public: namespace entity { -/// base entity shapes -enum Shapes {Diamond=0, Cube=1, Sphere=2}; - /// the entity registry extern std::vector registry; -- cgit v1.2.3