António
António

Reputation: 435

Add Cocos2D to project in xCode 4

I'm working in a project that need to have same parts native (cocoa touch) and some parts in cocos2d. I have made the all the native and now I need to integrate cocos2d in the project. My problem is that i cant add with success the cocos2d library to my project. Any good solution to do that? I'm using xCode 4

Upvotes: 7

Views: 4761

Answers (2)

clive dancey
clive dancey

Reputation: 143

Once you have downloaded the Cocos2d version from the link above, you need to open 'terminal' and drag the install-templates.sh file into the terminal window.

Everyone kept saying "drag the directory into terminal then type the above" but it comes back saying 'is a directory'. I searched for ages to do this and found this answer.

Once you have dragged the install-templates.sh file from the Cocos2d directory, hit return and it installs the Cocos2d templates to your Xcode directory.

Then you can open a project in Xcode and it has the templates ready for you.

Upvotes: 1

asinesio
asinesio

Reputation: 345

You essentially have two choices.

Option 1: Add cocos2d files to your existing project

  1. Add cocos2d files to your project as normal (drag the source files in, copy to dest folder).
  2. Create an EAGLView in a View Controller and bind it to the CCDirector. (See an example project for reference.

Option 2: Install your existing code into a fresh project using the cocos2d templates

The latest version of cocos2d (1.0-RC) has XCode 4 templates. Install them:

install-templates.sh --force

Then create a new cocos2d project using those templates in XCode 4. Add your existing files and update the project that it creates, and you should be good to go.

Personally, I've had better luck with Option #2, but most of my code is pretty easy to move around.

Upvotes: 5

Related Questions