Closed jasonmeverett closed 3 years ago
Say I have a component handle:
Entity * e1; ComponentHandle<ComponentType1> handle = e1->component<ComponentType1>();
I'd like to get the orignal entity from the component handle, such as:
Entity * e2 = handle->GetOwningEntity(); e2 == e1
Is this possible in EntityX? A workaround I could think of is having:
struct ComponentType1 : public Component<ComponentType1> { ComponentType1(); ComponentType1(Entity * e) : self(e) {} Entity * self; }
And then always calling such as:
Entity * e1; ComponentHandle<ComponentType1> handle = e1->component<ComponentType1>(e1);
Is there a more structured way to do this?
Thanks in advance!
Can we move these discussions to https://discourse.swapoff.org/c/entityx/7? GitHub is not really a great conversation/help platform. If you'd like to move these questions over there, I'm happy to chat.
Say I have a component handle:
I'd like to get the orignal entity from the component handle, such as:
Is this possible in EntityX? A workaround I could think of is having:
And then always calling such as:
Is there a more structured way to do this?
Thanks in advance!