Cocos2d-x Hello world analysis entry
* *********************************** Please specify the source: bytes ********************************************
Digress: I just got home yesterday afternoon, and you know that...
Body:
Well, the last back to build a Cocos2d-x environment, now open it to play.
This article is an analysis of the depth of wood ~.~
Open the created file with vs2012 and find the following content:
The first three are additional class libraries:
Libaudio audio and audio database
Libchipmunk chipmunk physical engine support library
Libcocos2d cocos2d-x Core Engine Library
Then, mygame's own project
There are four parts:
1. Put the classes in our files, and write your own classes ~
2. Resource puts our resource files, music and images used in the game. Originally, game. RC is a resource file format such as bitmap stored by VC.
To add a resource, you can place the resource in the resource folder of your project, even if the Resource Directory does not have this resource. The image is preferably in PNG format.
3. Win32 program call entry.
4. What other classes or items are called in the external dependency
Take a look at the two classes in the classes folder, one appdelegate and one helloworldscene.
First, appdelegate is the entry class of the program. The mian function of Win32 calls appdelegate.
Then, appdelegate is mainly responsible for some basic functions of the application:
When the program is loaded, call the function: applicationdidfinishlaunching ()
When a call arrives, the program enters the background and calls the function: applicationdidenterbackground ()
When the process ends, the program recovers and calls the function: applicationwillenterforeground ()
The second category, as its name implies, is the scenario class. It shows a scenario where the content is similar to images, exit buttons, and necessary helloworld.
This class is a layer that is initialized using the init method,
The layer contains the buttons closeitem, text label, and Sprite.
Each has a common definition:
1. Create
2. Location setposition
3. Add to layer addchild
Of course, this is only the general situation. There are some special cases, such as buttons, the added menu, and the callback function (that is, click this button to execute the content)
Well, this is the case for the moment ~.~
One small step every day, slowly accumulating.
* *********************************** Please specify the source: bytes ********************************************