iOS Import cocos2d Games

Source: Internet
Author: User

First, Xcode in its own project to introduce COCOS2DX, need to import cocos2d_libs static library. First need to download cocos2d engine, cocos2d engine download link Click to enter the official website

Second, copy the Cocos2d engine to the engineering catalogue and add Files to the project. Added to the project.

Third, add dependent library

Iv. Configuration of the project

1. Configuration in Build settings
Set valid architectures

2. Build Options->enable Bitcode set to No

3, set other Linker flages as follows

4, in Project set header Search Paths, relative path, cocos2d folder in Importcocos2d2.xcodeproj's sibling directory, so this is the path. $ (srcroot) is the. Xcodeproj location

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 languages

9. Set PCH Path

Load cocos2d game file, need to modify delegate name, modify the agent name in main

//main function contents  # Import  <uikit/uikit.h>#import   " AppController.h " int  Main (int  argc, Span class= "hljs-built_in" >char  * argv[]) { @autoreleasepool  {return  uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([AppController class ])); }}
//pch内容#ifdef __OBJC__    #import <Foundation/Foundation.h>    #import <UIKit/UIKit.h>#endif#ifdef __cplusplus    #include "cocos2d.h"#endif

Operating effect:

iOS Import cocos2d Games

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.