Well spotted, I forgot to write the destructor!
As for the stack, I wanted to keep it a vector so that multiple states can be drawn at a time.
For example, a pause state over a game state. (functionality still needs to be implemented however).
An std::stack doesn't allow this (as far as I'm aware).
By component based system I meant most classes of the engine can be used independently of each other.
But an Entity System is actually next on the TODO list ![Cheesy :D](https://www.sfml-dev.org/forums/Smileys/default/cheesy.gif)
For reference, what would you like the entity system to do?
Oh yes, my system only draw 1 State at time, that's why i've chosen a stack.
I just wrote an article about Entity SYstem, but in french. I'll resume it.
If you want one (and need it), you should read this article :
http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/I implemented my system like this :
An entity isn't a class, it's just an ID in a table (because an Entity, IMHO, shouldn't have data nor functions).
I store all Entities' components in an array in a "entity manager" class.
There are many ways to implement that system, make a Class for an entity isn't wrong, there are cases where it's usefull (but IMO thre are more cases where it's useless :p)
Here is the history of my Entity System in UML :
First version, Entity is a class, I update all components at each loop (wich is very bad) :
![](http://blog.monstruosor.com/wp-content/uploads/2012/05/ES1.png)
Second version, Entity is still a class but each component can register for events types that insterest them. It's good but you need a very good Event class that doesn't just copy the sf::Event :
![](http://blog.monstruosor.com/wp-content/uploads/2012/05/ES2.png)
I haven't done this Event class well so I tested my last version :
![](http://blog.monstruosor.com/wp-content/uploads/2012/05/ES3.png)
I think there is a huge part a feeling question (how yo prefer the component to comunicate with each other, etc..)
Another famous link :
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/