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!