cocos2d-xccscene

Know when CCScene is shown after scene on top of stack is popped


Using `cocos2d-x, say I am on Scene 1 and I add a new scene (Scene 2), but I later pop that scene:

CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->popScene();

How do I know when Scene 1 has appeared again? Is there any sceneDidAppear method or something similar?


Solution

  • CCScene is derived from CCNode, therefore you can override onEnter() and onExit() method to know when a scene is pushed or poped.