posted by 04/23/2014 author zrong -24 Comments ↓11,687 views
- This site is reproduced in addition to the article, are the original site or translation.
- The article welcomes all forms of reprint, but please 18 years of age and above the reprint of the source of the article, respect for my labor, but also respect your IQ;
- This site part of the original and translated articles to provide markdown format source code, welcome to use the source of the article reproduced;
- This article title: How to Learn cocos2d-x?
- This article link: http://zengrong.net/post/2100.htm
How to learn cocos2d-x?
How to study cocos2d-x?
This is my answer to the above, the original is here (modified): How to learn a development framework (such as: mobile phone development cocos2dx direction)?
It happened that I also transferred from AS3 to Cocos2d-x, tell me about my experience.
I. COCOS2D-X PART 1.1 Technology selection
From the third hand tour began, I really was Adobe's ane and small domestic platform to toss the temper, decided to go to Cocos2d-x. In the choice of which language binding for a long time, and finally Lipaizhongyi selected Lua:cocos2d-x script language Binding:lua or Javascript? Cocos2d-x 2.x's LUA bindings were not doing well, so I chose quick-cocos2d-x.
1.2 Learning C + +
"C + + Primer" is a good introductory book, suggested to see the fifth edition, I wrote a c++primer 4th and 5th version of the comparison. During the study, it is suggested to draw some mind map to help understand and organize ideas. For example this (incomplete):
1.3 Learn demo and get familiar with the development platform.
Compile Cocos2d-x's own Testcpp project and run it all over again. Familiarize yourself with the usage of the Cocos2d-x API. Remember to generate a document that advises you to browse through the functionality of each API.
In the process of learning the demo, you must also be familiar with the IDE of your own development platform, such as Windows must be familiar with Visual Studio, and OS X must be familiar with the Xcode,linux platform on the familiar ECLIPSE+CDT bar.
Note that Quick-cocos2d-x is not supported for Linux development platforms.
1.4 Understanding the folder structure of the engine
Based on the Cocos2d-x source code generated documents are not how detailed, many features must look at the source code. But at this stage, I do not suggest tangled source too deep, but can be entangled in the Cocos2d-x folder structure, to see where each class is placed, find out which of the common macros and constants and the enumeration definition where, it will not take much time, but can let you have a deeper understanding of cocos2d-x, At the same time give you a strong sense of accomplishment. This sense of accomplishment dilutes your sense of powerlessness in the face of a lot of source code, allowing you to move on.
Here is my analysis:
1.5 Repeat the 3rd step above: Learn demo again
It may be a lot easier to see the demo at this time, but you'll have more problems to tangle with. For example, multi-resolution support? Like the coordinate system? such as the drawing function? Like a hierarchical management system? such as the event delivery system? Wait a minute ... etc... This time you can go to Google (do not use hundred poison and other search engines) to look for documents. I recommend some of the good documents and blogs I've seen:
- Cocos2d-x Multi-resolution adaptation full resolution
- Cocos2d-x official Chinese document v2.x
- Zilong-Blog Park
- Red Babe's Game programming road
- cocos2d | IOS Development Tips & Tricks by BiOM
- Ray Wenderlich
- Cocos2d-x | Cross Platform Open Source 2D Game Engine
Many blogs are excellent. Red Child wrote a lot of source code analysis, each sentence source has been added detailed comments. Although I don't quite agree with his thankless approach, it really helps the novice.
Also in Stack Overflow you can find answers to most of the questions. Of course, many of the problems are aimed at cocos2d rather than cocos2d-x, but using the same, care is not mistaken. Many excellent articles are based on cocos2d, so, do not mind, you can first spend half a day familiar with OC grammar, can read.
Don't buy Chinese books for the time being. I have spent 3 days reading the "Cocos2d-x Game development Technology" and "Cocos2d-x mobile game development – Cross iOS, Android and the phone platform", found that the author is actually to earn royalties.
Forget the ad, my blog (cocos2d-x | Zrong ' s Blog) also has some cocos2d-x content, welcome to spray.
1.6 Familiar with Toolset
Now you should be interested in the peripheral tools. For example, what does frame animation use? What does Bmfont use for production? What about skeletal animation? How can the plist file be edited? What tools are used to flatten a broken chart? On some projects, you have a lot of options and maybe no choice. Go to Google, if you encounter the choice of problems, welcome to discuss with me.
Ii. Quick-cocos2d-x Part 2.1 It's time for Lua now.
Please read the "LUA Program Design (2nd edition)" 第一、二、三部 points carefully. Part IV may not be read temporarily.
2.2 Familiar with the QUICK-COCOS2D-X folder structure
Believe that with the above Cocos2d-x Foundation, this should not be difficult to understand.
2.3 Run out of all the sample quick-cocos2d-x comes with
During this time, you are familiar with all the footprints in the framework. You can refer to the Quick website and the quick wiki.
2.4 Learning Export API for LUA use
Export the C + + API for Lua use
Third, learning OpenGL ES
After being familiar with the LUA part, as a code farmer who is interested in becoming a programmer, he still has to return to C + +, which is the essence of cocos2d-x.
Cocos2d-x is rendered using OpenGL ES, you are completely out of OpenGL ES if you want to extend any form of Cocos2d-x's render layer.
If you can't escape, then say to her, please open your legs, I will go.
3.1 Read OpenGL ES 2.0 Programming Guide
The following is the official website of this book, now out of the OpenGL ES 3.0 version, cocos2d-x using 2.0.
Http://www.opengles-book.com/es2/index.html
This book is easy to understand and very suitable for beginners. A netizen spent 3 months translating the Chinese version, but it is recommended that you do not look.
This is the official document and API translation for OpenGL ES.
Of course, you can also buy the famous OpenGL Red Book "OpenGL Programming Guide (7th edition)", but OpenGL ES is still somewhat different from OpenGL, and you need to know how to differentiate between these differences.
3.2 Trying to understand the rendering part of Cocos2d-x architecture
Related classes I will not list, I am brewing a series of articles in this area ready to be sent to the blog. If I finish, I will update here.
3.3 Write the extension of the filter and drawing function yourself
For example this: cocos2d-x-filters
Iv. Project of Return
When you get here, you can start your project. Although the source has not finished reading, but I believe the entire architecture can understand. In the process of doing the project, then go a little bit to read the source code is relatively fast and I can accept the method, otherwise it is too dull.
You may also need to select Cocos2d-x related tools. You may have heard of CCB (Cocosbuilder) and CCS (Cocostudio), trying to understand them, and then deciding whether to use them.
You already have the foundation of AS3, so many front-end concepts and experience are already rich. These experiences also apply in the cocos2d-x. However, it is important to note that Cocos2d-x is not AS3, do not attempt to use the AS3 method of Cocos2d-x.
- A bit of a code farmer complained to me when he went from C # to AS3: Why doesn't Flash builder have this feature of Visual Studio?
- And then the code farmer complained to me when he went from AS3 to sublime text (for Lua editing), why sublime text doesn't have the function of Flash Builder?
It's a joke up there.
At the same time, in order to solve some cocos2d-x not provided by the function, you have to learn the relevant knowledge. For example: the Upload file function (with Quick-cocos2d-x package) is implemented in Cocos2d-x using Libcurl. But now that you have a foundation, it's not difficult to learn.
When you have time, read the "LUA Program Design (2nd edition)" section fourth above, and learn how Lua and C communication work, by the way, and see how cocos2d-x is implemented.
In addition, some of the features you need are not in the engine, you can easily realize the open source (such as this: a Luasocket package), perhaps you need is just what others need.
Five, familiar with the publishing platform
Since it is a hands-on tour, Android and iOS platforms are not escaping.
Familiarize yourself with the features of the Android and iOS platforms, familiarize yourself with the Java language application on Android, familiarize yourself with the objective-c application on iOS, and familiarize yourself with Eclipse ADT and Xcode (which should be familiar).
You'll also be familiar with Google Play and AppStore's release process and guidelines, policies, access to internal purchases, and embedding of the SDK.
You have to learn to deal with the programmers, the business, the front-desk of the various access platforms (because you will often not find the actual technician responsible for the SDK), you will be able to endure the poor domestic platform of the documentation, code specifications and inverse programming method.
End, no end
The above said is not complete, should be missing a lot of things, but I can only say so much. Because my experience also ends here.
I wish you success!
Related articles
- Drawing API in Quick-cocos2d-x
- Upload file function with Libcurl in Cocos2d-x (Quick-cocos2d-x package included)
- Export Ccfileutils::getfiledata to LUA using Quick-cocos2d-x
- Tiling a power texture that is not 2 in Quick-cocos2d-x
- To implement the Eraser function in Cocos2d-x
‹ Managing GIT Libraries with submodules (dragonbonescpp) Get the pixel values of textures in cocos2d-x › Article Classification Technology Tags: C, cocos2d-x, how-to, study
How to learn cocos2d-x?