It's always a question of size.
When your game is really small, maybe you'll be able to put everything in one Draw and Update function and still have a nice overview between all those if-statements.
Okay I don't know how you handle diffrent states, but what you probably basicly do is use one method but react diffrent to the active 'state'. So why not exclude it?
Use for each state a own method, yes maybe you will this way have to init somethings more than with the other design, but making a abstract state-class of which other abstract classes can be deriven will help you minimize those repetion.
I recommend it for 'real' projects. :wink:
I made myself some thoughts about preserving states, but didn't end up with some code just ideas, but maybe not the most efficient ones.
My idea was that there could be four data structurs:
- array/std::vector - containing loaded states
- queue - containing states to activate in the next update loop of the statemanager
- queue - containing states to deativate in the next update loop of the statemanager
- stack - containing the running states
So you should be able to deativate/activate any loaded state out of any state. (If you programm the statemanager right ^^)
Don't know if it will work or if it is any good. It would be my first own statemanagement system so I'm also new to this... :?
But there is already implemented stuff like the GQE ->
http://code.google.com/p/gqe/Browse through the code to see how he's done it!
eXpl0it3r
EDIT:
I've seen that there's another similar discussion running
here.