Managing scenes

Hi,

I need to manage may scenes in a way that they keep the same state (not been recreated).

For example, if I have these screens in my game

MainMenu
Help
Play
Pause

These are possible screens sequences:

MainMenu~~>Help~~>MainMenu
MainMenu~~>Play~~>Pause~~>Help~~>Pause~~>Play
MainMenu~~>Play~~>Pause~~>MainMenu

In both cases, the flow must return to the previous screen, and this previous screen must no be deallocated, it´s state must be keept.

How to do that?

Thanks

Jose

Maybe this will help:

MainMenu->Help->MainMenu
Root      Push  Pop

MainMenu->Play->Pause->Help->Pause->Play
Root      Push  Push   Push  Pop    Pop

MainMenu->Play->Pause->MainMenu
Root      Push  Push   Pop*2

CCDirector has pushScene and popScene functions for scene management. The pop*2 may require some extra logic in the parent scene since I believe it may be only possible to pop a single scene per frame.

http://www.cocos2d-x.org/embedded/cocos2d-x/db/d7f/classcocos2d_1_1_c_c_director.html