Creating scenes
The scene concept is very important within the Cocos2d-x game engine, since all the displayed screens in our game are considered scenes. Creating an analogy between Cocos2d-x and the Android native Java development, we can say that a Cocos2d-x scene is equivalent to what Android calls activity.
In the previous chapter we introduced the AppDelegate
class, and we explained that it has the responsibility of loading the framework on the device and then executing the game-specific code. This class contains the ApplicationDidFinishLaunching
method, which is the entry point of our code. In this method, we instantiate the scene that is going to first be displayed in our game, and then request the director
to load it, as we can see in the following code listing:
bool AppDelegate::applicationDidFinishLaunching() { auto director = Director::getInstance(); // OpenGL initialization done by cocos project creation script auto glview = director->getOpenGLView(); auto scene...