1.cocos2d-x has a file "Cocos2d.h" that contains all the other header files. In general, we only need to include this header file when we use it, so we can use the full functionality of the engine.
2.cocos2d-x classes are placed under the Cocos2d namespace. In the game, we often use another macro using_ns_cc provided by the engine to refer to the Cocos2d namespace:
#define USING_NS_CC USING namespace cocos2d.
3. Class naming is consistent with Cocos2d-iphone, consisting of class library abbreviations plus class names, in which class library abbreviations are capitalized, and class names are camel-based. The abbreviation for cocos2d is CC, so cocos2d-x classes have CC prefixes, such as classes that represent actions, called ccaction.
4.cocos2d-x does not use traditional value types, all objects are created on the heap and then referenced by pointers.
There are usually two ways to create a Cocos2d-x object: The first is to create an uninitialized object using the new operator, then invoke the Init series method to initialize it, and the second is to create an object directly using a static factory method.
Both of these methods can create Cocos2d-x objects, but they still have a little bit of a difference in memory management. The object created with the constructor is owned by the caller, and ownership of the object created with the factory method does not belong to the caller, so the object created with the constructor requires the caller to be freed, and the object created using the factory method is not required.
5. In Objective-c, the selector (Selector) is a mechanism similar to a class function pointer in C + +. Because Cocos2d-x inherits the code style of Cocos2d-iphone, it also provides a series of macros similar to those created in the selector syntax in objective-c to create function pointers. These macros have only one parameter, selector, that represents the class method being pointed to.
6. Properties
7. Single case
Code Style--COCOS2D-X learning process (iv)