Thursday, January 1, 2009

XCode Template for cocos2d

This open source game Libray is for you to development games for iPhone using XCode. The current version is 0.6.2

The project source is here

These are the features of the library:
* Scene management (workflow)
* Transitions between scenes
* Sprites
* Actions
* Basic menus and buttons
* Integrated Chipmunk 2d physics engine
* Particle system
* Text rendering support
* Texture Atlas support
* Tile Map support
* Parallax scrolling
* Touch/Accelerometer support
* Portrait and Landscape mode
* Integrated Pause/Resume
* Supports PowerVR Texture Compression (PVRTC) format
* Language: objective-c
* Open Source: Compatible with open and closed source projects
* OpenGL ES 1.1 based

Here is the XCode Template, so that you can create new project and start 2d game programming

Installation Instruction of this XCode Template for cocos2d 0.62

curl -O
unzip -d "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates"

Here is a quick primer guide to start development with a simple game using cocos2d, this XCode template is also created based on the method as described in this article
and these two as well

After installation of this XCode Template, you can create new project for cocos2d library

A Makefile is also included so that you can build the created new project and ldid fake codeign and install in the /Application folder of iPhone

(1) you need to change the IPHONE_IP in the Makefile
(2) make install_respring
(3) make
(4) make install

If you want to install your Mac public key in iPhone so as to avoid typing password using ssh, please refer to my previous post here

The api documentation of cocos2d are here

Update : Cocos2d v0.7 XCode Template

curl -O
unzip -d "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates"

This new XCode Template v0.7 has been restructured so that when cocos2d is updated in the future, you can just copy the new cocos2d directory and replace the cocos2d-iphone in the old project directory e.g.

cp -r ~/Downloads/cocos2d-iphone-0.8/* ~/Projects/myproject/cocos2d-iphone/
rm -fr ~/Projects/myproject/cocos2d-iphone/cocos2d-iphone.xcodeproj


Anonymous said...

thanks mate, very helpful!

Anonymous said...

Thanks much, very helpful.

What's the process once a new version of cocos2d is released to update the template as well as any existing projects?

Thanks in advance!

John Muchow

Pablo said...

New template for 0.7, here

slumlord said...

that was fast. thanks!

Anonymous said...

Is there anyway to combine these templates with the "iPhone Pwned Developer" templates so that I can debug on an unlocked iphone? I can do it using your other templates, but I'm not sure what to do to make this one work.

javacom said...

You just do these (if you did not have official developer certificate)

1) Do the skip provisioning profile in XCode see here
iPhone sdk 2.2.1

iPhone sdk 2.2

2)add the followings to the 'Info.plist' of the project created under cocos2d.

<string>Apple iPhone OS Application Signing</string>

3) Use the "iPhone Pwned Developer" to codesign and build & go in XCode

Unknown said...

Do you know how to get around codesigning on the 3.0 SDK? I've tried the method you posted above, along with some extra steps I had to do when I did 2.0 but haven't been able to get it to work.

emdo said...

XCode Template for cocos2d 0.8.1 with makefile and ldid fake codeign

Note : i can compile the project using xcode 3.1.3 sdk3.0 without errors
Note : to copile without xcode
cd __theproject__
(1) you need to change the IPHONE_IP in the Makefile
(2) make install_respring
(3) make
(4) make install
Note : the project ....

i'am trying to compile the template provided with cocos2d-iphone0.8.1 without the apple account($99) using the makefile and ldid fake codeign but when i use make i get the following error

In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:47,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:38,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9,
from cocos2d/Support/ZipUtils.m:21:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/MacTypes.h:667: error: redefinition of typedef ‘Byte’
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/zconf.h:261: error: previous declaration of ‘Byte’ was here
make: *** [cocos2d/Support/ZipUtils.o] Error 1

any help please

Anonymous said...

Do you have the Makefile for SDK 3.0 or it is working for iphone 3.0.1 or later?

I can successfully compiled the existing code and copy to iphone, but when I launch it, it quit immediately
Please advice