diff options
author | Alec Thomas <alec@swapoff.org> | 2014-06-20 21:39:52 +1000 |
---|---|---|
committer | Alec Thomas <alec@swapoff.org> | 2014-06-20 21:39:52 +1000 |
commit | 9b2de3c0cc35dd4b7dcdb240b8852325531e70d7 (patch) | |
tree | 95551cf1a291cb5cf3fc64145f013f24ad8e688f | |
parent | f7870b61d8afc76485af5fdab2599d261444db96 (diff) | |
parent | 5b8e0ae73b4a5c9e19050ceb2b045dd0f5f8b54e (diff) |
Merge pull request #35 from x-w/master
Add "Entity::component() const" which returns a handle of const component
-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_); |