Cocos2dx:CCDirector
lastmod 2018-08-17created 2017-11-101 edits
The CCDirector class is a singleton class, meaning only one instance exists in an application. Cocos2dx provides the ability to organize and handle game screens in units of scenes. The CCDirector class manages these scenes, moving back or forward between them.
Features
- Manages the back-and-forth order of Scenes
- Implemented as a shared Object (singleton).
- Responsible for initializing OpenGL ES
- Manages scene calls
Getting the screen size
The screen size can be obtained as follows.
Switching scenes
- pushScene(): Keeps the existing scene and places a new scene on top of it.
- replaceScene(): Removes the existing scene and replaces it with a new one.
- popScene(): Ends the current scene and returns to the previous scene (POPs it).
- popScene(): Ends the current scene and returns to the previous scene (POPs it).
- popToRootScene(): Returns to the ROOT scene.
Exiting the program
The program exits as follows.