Cocos2d-X authoritative guide notes

Source: Internet
Author: User

An overview of Cocos2d-X's authoritative guide notes has recently been reading Cocos2d-X's authoritative guide, an electronic version of the book online ). I think that others' books are always others' books. It takes a long time to learn something special from them. As the beginning of a book (making programmers Fall In Love With iPhone Development (2013 autumn iOS 7)-complete article): "Time is the most valuable asset, only select the information you need! ". So another new path came up with the idea of translation cocos2d-x, since the thought of it to do it, because the latest version is 3.0, so simply translate him! Another note: as some classes introduced by the Cocos2d-X authoritative guide are outdated, they are not listed here. Connection 1. cocos2d-x node (CCNode. h) The API class is a basic class. The most common nodes are: Scene, Layer, Sprite, menu 1.1 graphics getter and setter attributes (z sequence, OpenGL vertex, position, scaling, rotation, tilt angle, anchor point, size, visibility ......) 1.2 relationship between children and parent (Add/delete children, add an identifier for children, obtain the total number of children, and obtain the parent of children ......) 1.3 set Object Effects, set schedule for objects, convert various coordinates, and add and remove components. cocos2d-X Director class (Director. h) API director class, which creates a main window to manage all the scenarios (usually there is only one director in a game) 2.1 get the currently running scenario, get the number of frames per second, whether to switch the scenario, get the View Size, switch/stop Scenario, clear cache, set configuration information 3. cocos2d-X node (CCLayer. h) The API Layer is a subclass of Node, which implements the TouchEventsDelegate protocol. all functions of the node are valid, and the following new features are added: it can receive the touch of the mobile phone, it can receive the input acceleration 3.1 enable/disable the touch event/sensor event/keypad event 3.2 LayerRGBA, LayerColor, LayerGradient, MultipleLayer is the Child class of the Layer, they extend all the features of the layer. 4. cocos2d-X node (CCMenu. h) Create an API menu, add items, and set the items method. 5. cocos2d-X node (CCMenuItem. h) API creates various types of item 1 for menu items. enable/disable item, whether to select item 2. menuItemLabel, MenuItemA TlasFont, MenuItemFont, MenuItemSprite, MenuItemImage, MenuItemToggle, and CCMenuItem-related classes 6. cocos2d-X node (CCSprite. h) API Sprite is a 2d image 1. update Sprite texture, set sprite's batch processing node, set sprite's index in TextureAtlas... 7. cocos2d-X node (CCTexture2D. h) API Paster class CCTexture2D is about OpenGL concept. In OpenGL, the image is called a texture. In Cocos2D-x, CCTexture2D is the meaning of the image object. It can be used to create objects such as Genie. CCTexture2D class is the basis of the genie class and its related classes. The following shows that many classes can be defined using the CCTexture2D class. 8. cocos2d-X node (SpriteBatchNode. h .) API SpriteBatchNode is a batch processing node: if it contains children, it will draw all children at once (usually called "batch drawing "). if you want to draw a large number of objects, using SpriteBatchNode can improve game performance 9. cocos2d-X node (CCSpriteFrame. h ..) the API is similar to sprite 10. cocos2d-X node (CCAnimationCache. h) Use APIs to manage Singleton of Animations (Singleton ). it stores animations in the cache. if you want to store your animations in the cache (cocos2d calls all animations animatiosns), you can use this class 11. cocos2d-X node (CCCamera. h .) API CCCamera. h. Simply put, it is the perspective (Ratio If you see a house, the house you see from different angles is different. It is equivalent to the position where your eyes are located. It is useful for you to create 3d images) 12. the cocos2d-X node (CCDictionary) API uses it to save some data, which is similar to the hashmap object in java and stores the index object through key/value pairs, its key) it can be String/Integer type 13. cocos2d-X node (CCAction. h) API actions must be dependent on the CCNode subclass to take effect. 1. the CCAction subclass FiniteTimeAction can be used for instantaneous and delayed actions. the Speed subclass of CCAction can simulate slow actions and fast forward actions 3. the Child class of CCAction Follow Action is followed by 14 nodes. cocos2d-X node (CCActionManager. h) API Action Manager is a singleton for managing all actions. under normal circumstances, you do not directly use this singleton. 99% of the cases are that you want to use the interface of this node. however, in some cases, you may need to use this singleton. You want your actions to run on different nodes. You want pause/resume actions15.cocos2d-X node (CCIMEDelegate. h) in the game, you sometimes need to enter the user name and password. In this case, you need to call the virtual keyboard. In Cocos2D-x, this function is implemented by using the input box class CCIMEDelegate of the inherited Input Method proxy class and Its font label class CCLableTTF of the font CCTextFieldTTF 16. cocos2d-X node (CCLabelAtlas. h) API LabelAtlas is a subclass of AtlasNode. its speed can quickly replace tags. labelAtlas is faster than Label:-LabelAtlas is faster than Label-LabelAtlas "characters" has a fixed width and height // character-LabelAtlas "characters" can be whatever you want, because they evolved from a file. cocos2d-X node (maid. h) API CCLabelBMFont. h is a text rendering label class. Each word in the CCLabelBMFont class is a Sprite class, which means that every Can be self-rotating other actions 18. cocos2d-X node (CCLabelTTF. h) API abelTTF is a subclass of TextureNode, it can render the label labels (the text displayed above the label ). All TextureNode functions are valid in LabelTTF. The LabelTTF object is very slow. use LabelAtlas and LabelBMFont instead. 19. cocos2d-X node (CCTileMapAtlas. h) The API can use CCTileMapAtlas to create a map 20. cocos2d-X node (CCTMXLayer. h) The API is a subclass of SpriteBatchNode. by default, tiles (tile) is rendered using TextureAtlas. If you modify the tile at runtime, the tile will become a sprite21.cocos2d-X node (SimpleAudioEngine. h) The API controls the playing of the sound and sets the volume to 22. cocos2d-X node (curl. h) API network connection operation APi, specific how to use recommendations for reference, Cocos2d-x authoritative guide 23. cocos2d-X node (CCTextFieldTTF. h) API to open the keyboard to obtain text input 24. cocos2d-X node (CCUserDefault. h) API UserDefault is used as a small database. you can use it to save/obtain the basic type value. 25. cocos2d-X node (CCTouch. h) The API generally puts the contact information in the CCTouch class. The CCTouch class encapsulates the touch point information, including the x-axis and Y-axis values of the touch point, 26. cocos2d-X node (CCTMXObjectGroup. h) Fine API Map Spirit group class. CCTMXObjectGroup is used to represent the genie group 27 in the map. cocos2d-X node (CCMotionStreak. h) in the implementation process of a game, the API sometimes needs to achieve a gradual effect on the Motion Track of a game object. This is like dragging the tail of an airplane, Which is visually good, such as the trajectory of a bullet. Without the help of an engine, this effect is often achieved through a large number of images. The Cocos2D-x provides a built-in drag gradient effect class CCMotionStreak to help us achieve this effect. 1. 22. For details that are difficult to understand, see the Declaration in the original article. The statement is as follows: some content may be inaccurate and ambiguous because it has not been reviewed twice... the above situation is that you can refer to the source code to see the original article (each translation has its cocos2d-x-3.0alpha0 directory above, you can find them in the directory, if you are not using this version, the specific location may be different. We recommend that you search for this version). If you have better suggestions, you can make it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.