In my project, i have some class which do too much thing.
BuildingManager is a singleton, right now it does
- Hold the vector of buildings
- Process OnClick events (i detect which building was clicked by iterating over them unless i found the clicked one)
- Update them
- Draw them
- Add building
It's maybe too much for a single class.
The alternate which is in my mind:
BuildingsHolder singleton class: (do you know better name? )
- Hold the buildings vector. (it have the interface to add new ones)
- Process the events, like onclick (not just for buildings)
- Call the update ticks on everything (like max 80-100 times a second)
Drawer (don't know better name yet):
- Call the draw on everything
Well, i don't know, while most of these seems reasonable i feel like it's still far from a good solution.
Btw, i don't want to ending up with a bunch of singleton for the Event related things, ticker, drawer and other stuffs. (i think in this case it's not hard to avoid tho)
How would you separate these things?