• Create Account

### #Actualskwee

Posted 03 November 2013 - 04:03 AM

Thanks for the examples and reference to entityx (which I already checked), simber. However, it still doesn't fix my issue: How components are stored inside the spawner (or whatever we call it)?

Going back to your previous example

Entity e = spawner.spawn();
for( auto &comp : prototype )
{
spawner.attach(e, comp->clone());
}


Lets continue with spawner, even though the name is incorrect and Ill probably add another class that will be responsible for storing the components.

First of all, how would attach() be implemented?

Second of all, how would getEntitiesWithComponents<X, Y ..>() be implemented?

I'm pretty weak with templates this why I ask.

I looked a bit into entityx. I see how they implement the component storage. They provide a family for each component. This is an elegant solution, you then can store all components in one list, instead of separating each component into its own list. What do you think about this approach?

Thanks a lot!

### #1skwee

Posted 03 November 2013 - 01:35 AM

Thanks for the examples and reference to entityx (which I already checked), simber. However, it still doesn't fix my issue: How components are stored inside the spawner (or whatever we call it)?

Going back to your previous example

Entity e = spawner.spawn();
for( auto &comp : prototype )
{
spawner.attach(e, comp->clone());
}


Lets continue with spawner, even though the name is incorrect and Ill probably add another class that will be responsible for storing the components.

First of all, how would attach() be implemented?

Second of all, how would getEntitiesWithComponents<X, Y ..>() be implemented?

I'm pretty weak with templates this why I ask.

Thanks a lot!

PARTNERS