aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--entityx/Entity.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/entityx/Entity.h b/entityx/Entity.h
index b55a45f..2382c11 100644
--- a/entityx/Entity.h
+++ b/entityx/Entity.h
@@ -201,6 +201,11 @@ public:
*/
void remove();
+ /**
+ * Returns the Entity associated with the component
+ */
+ Entity entity();
+
bool operator == (const ComponentHandle<C> &other) const {
return manager_ == other.manager_ && id_ == other.id_;
}
@@ -1036,6 +1041,12 @@ inline void ComponentHandle<C, EM>::remove() {
manager_->template remove<C>(id_);
}
+template <typename C, typename EM>
+inline Entity ComponentHandle<C, EM>::entity() {
+ assert(valid());
+ return manager_->template get(id_);
+}
+
} // namespace entityx