Ah, just a example.
Now I'm working in getting components for a current entity just by a entity ID. Seems like have multiple ways of doing this.
From my point of view I have a component that have a ID (a primary key) a EntityManager that store a map<ID, SomeDerivedComponent>.
Then I have a RenderableSystem that operates on a PositionComponent (a Transform Matrix) and a RenderableComponent. So, in my RenderableSystem I have to find all entities that have Position and Renderable component using the entity ID. If they have both, operate, else don't operate. Every time that I add a component I have to insert the component in the system using something like insert<ID, RenderableComponent>.
id = 5;
s.id = id;
r.id = id;
for all entities e
if(spatials.find(e) && renderables.find(e))
//update with renderable system
What I want to know if is there some better ways of doing this or I must perform this loop every update.
Edited by irlanrobson, 23 October 2013 - 09:03 AM.