Cocos2D (ii) ---- use of cocos2D documentation ---- cocos2d

Source: Internet
Author: User

Cocos2D (ii) ---- use of cocos2D documentation ---- cocos2d

When using cocos2d for game development, it is inevitable to check cocos2d API documentation to find out how to use a class or method. Fortunately, the cocos2d author has added a document comment in the source code. We only need to use the document generation tool to parse the source code to generate the document. The most common tool for generating documents is Doxygen.

There are two ways to use Doxygen to process cocos2d documents:

1st Methods: Install the Doxygen software, parse the cocos2d source code, and generate static documents in html Format

2nd Methods: Use the built-in Doxygen function of cocos2d to integrate documents into Xcode

The following describes the implementation steps of the above two methods:


Generate HTML document

1. Download Doxygen software http://www.stack.nl in dmg format /~ Dimitri/doxygen/download.html # latestsrc

 

2. After installing Doxygen, open the software and set parameters.

 

3. Click Run doxygen to generate the document.

 

4. After the file is generated, open the file generation location (the cocos2d folder was just set) and add an html folder,

 

5.open the index.html file in the HTML folder. This is the document entry.

 

6. All classes can be viewed here.

 

7. Let's take a look at the CCSprite class.

 

8. Have an inherited structure chart

 

9. List of methods available

 

10. Click a method to view detailed descriptions of the method.

So far, html-Format documents have been completed.


Integrate cocos2d documents into Xcode

Note: cocos2d is 1.0.1 and Xcode is 4.5.

Prerequisites: Install the Doxygen software in the Applications directory.

1. Open the doxygen. config file in cocos2d and set it to output the Chinese document (in fact, only some keywords are Chinese. This step can be omitted)

 

 

2. Double-click to open cocos2d-ios.xcodeproj

 

3. Set cocos2d-documentation to target

 

4. Compile this target

Tip: After you click compile, some scripts will be automatically executed to generate the document. Please be patient. Many Errors and warnings are generated during compilation. This does not affect document generation and can be ignored.

 

5. Seeing Build succeed indicates that the document has been generated. In this case, exit Xcode and re-open Xcode. Then, view the document.

 

6. You can see that the cocos2d document has been integrated into Xcode.

 

7.The essence is to package the document into a .doc set file and then generate it to:/Users/AppleIn the/Library/Developer/Shaerd/Documentation/DocSets folder (my username is apple), Xcode loads all the documents here, but only once it starts Xcode, this is why Xcode must be restarted to view the newly generated cocos2d document.

 

The two methods to process cocos2d documents are described. I personally recommend the following 2nd Methods: integration into Xcode, which is also the most common method in development.


Address: http://blog.csdn.net/q199109106q/article/details/8590609

Thank you ~!


How to enable cocos2d to use ARC

Set the User Head Search Paths to the Cocos2d source code path (for example,/Users/ming/Documents/cocos2d-iphone/**) and select recursive. 3. Open the cocos2d source code folder, find the cocos2d-ios.xcodeproj file, and drag it into your project. Click the project file again, click Build Phases, and add libcocos2d. a and libCocosDenshion. a from Link Binary With Libraries. The file name is red. 4. delete the libs folder. after running main, an error is reported, which is changed to: # import int main (int argc, char * argv []) {@ autoreleasepool {int retVal = UIApplicationMain (argc, argv, nil, @ "AppController"); Method 2: 1. when deleting the libs folder, select Remove References2. create a cocos2d Static Library and click Add Target. In the displayed dialog box, expand the Framework & Library group and select Cocoa Touch Static Library. click next. in the displayed dialog box, enter the product Name of the static library, cancel the following two check boxes, and click Finish. then return to xcode to select the created static library and set Always Search User Paths in its Build Settings. Yes. Set User Head Search Paths. /** 3. select the original program in TARGETS and add the libcocos2d-library.a4 in Link Binary With Libraries in Build Phases. click File-> Add Files to "name-of-project" in xcode, find the libs folder, and then cancel the Destination check box. Select Create groups for any added Folders for folders, add to targets only select the static library you created. Run the program. 6. Click Edit-> Refactor-> Convert to Objective-c ARC in xcode. Select your original target program in the pop-up dialog box, do not select the cocos2d-library target program. Click Check.

Is there any Cocos2D document?

The chm documentation is unclear. Generally, the source code is directly read. Why is cocos2d open source? The second question is, try boundingBox, sprite. boundingBox. size. width.
 

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.