Import cocos2d games to iOS

Source: Internet
Author: User

Import cocos2d games to iOS

1. Introduce cocos2dx to your project in xcode. You need to import the cocos2d_libs static library. First, you need to download the cocos2d engine from the official website.

2. Copy the cocos2d engine to the project directory and add Files .. to the project.

3. Add dependent Libraries

4. Configure the project

1. Configure in Build Settings
Set Valid ubuntures

2. Set Build Options-> Enable Bitcode to NO.

3. Set Other Linker Flages as follows:

4. Set the Header Search Paths in the project, relative path, cocZ signature? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vczJkzsS8/kernel/nU2s671sM8YnIgLz4NCgk8aW1nIGFsdD0 =" here write picture description "src =" http://www.bkjia.com/uploads/allimg/160416/0433095155-5.png "title =" \ "/>

5. set Other C flages
-DNS_BLOCK_ASSERTIONS = 1
6,

7. Apple LLVC 7.0-PreProcessing
Debug:
USE_FILE32API
CC_TARGET_ OS _IPHONE
COCOS2D_DEBUG = 1
CC_ENABLE_CHIPMUNK_INTEGRATION = 1

Release
USE_FILE32API
CC_TARGET_ OS _IPHONE
CC_ENABLE_CHIPMUNK_INTEGRATION = 1

8. Apple LLVM 7.0 Warnings-All versions ages

9. Set the pch path

5. to load the cocos2d game file, modify the delegate name and the agent name in main.

// Main function content # import
  
   
# Import "AppController. h "int main (int argc, char * argv []) {@ autoreleasepool {return UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppController class]);}
  
// Pch content # ifdef _ OBJC _ # import
   
    
# Import
    
     
# Endif # ifdef _ cplusplus # include "cocos2d. h" # endif
    
   

Running effect:

 

Related Article

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.