diff options
-rw-r--r-- | entityx/Entity.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/entityx/Entity.h b/entityx/Entity.h index 3504f6f..51ecb03 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -130,7 +130,10 @@ public: template <typename C> ComponentHandle<C> component(); - + + template <typename C> + const ComponentHandle<const C> component() const; + template <typename C> bool has_component() const; @@ -784,6 +787,12 @@ ComponentHandle<C> Entity::component() { } template <typename C> +const ComponentHandle<const C> Entity::component() const { + assert(valid()); + return manager_->component<const C>(id_); +} + +template <typename C> bool Entity::has_component() const { assert(valid()); return manager_->has_component<C>(id_); |