alecthomas / entityx

EntityX - A fast, type-safe C++ Entity-Component system
MIT License
2.23k stars 295 forks source link

more efficient way of looping trough a bunch of classes? #237

Open BBQGiraffe opened 4 years ago

BBQGiraffe commented 4 years ago

my game uses a lot of classes, and every time I add a new class type I have to add for (Entity entity : ex.entities.entities_with_components(ClassName)) to be able to update and draw it, this is crowding up my update function, is there a more efficient way of doing this?

alecthomas commented 4 years ago

You would typically have multiple systems, each doing distinct jobs, so it's a bit surprising that you have a single update function. The included example illustrates this approach, and it's how EntityX is designed to work.