Cocos2d-X-3.X scene and layer, cocos2d-X-3.X scene
1. scenarios and layer-related functions
1. void runWithScene (Scene * scene ).
This function can be used in running scenarios. This function can be called only when the first scenario is started. If a scenario already runs, you cannot call this function.
2. void replaceScene (Scene * scene ).
Switch to the next scenario. Replace the current scenario with a new one, and the current scenario is interrupted and released.
3. void pushScene (Scene * scene ).
Switch to the next scenario. Place the current scenario to the stack and switch to the next scenario.
4 void popScene ().
When used with pushScene, you can return to the previous scenario.
5 void popToRootScene ().
With pushScene (), you can return to the root scenario.
Note: replaceScene and pushScene are used differently:
ReplaceScene is released and destroyed.
PushScene is not released or destroyed. The status of the original scenario can be maintained. However, there cannot be too many scenario objects running in the game at the same time.