cocos2d Xcode 4 templates

cocos2d for iPhone Xcode 4 templates can be downloaded from here:

IMPORTANT:

As you might know, Xcode 4 has a new way to define templates. The new format is not documented, so, in order to create the new templates a lot of copy & paste, and trial & error was needed.

The current cocos2d Xcode 4 templates are not as polished as the Xcode 3 ones, but they include the basic functionality.

The package includes:

  • cocos2d template
  • cocos2d + Box2d template
  • cocos2d + Chipmunk template

The “file” and “Mac OS X” templates are not ready yet.

INSTALL (Option A):

eg:

$ mkdir -p ~/Library/Developer/Xcode/Templates
$ cd ~/Library/Developer/Xcode/Templates
$ tar xzvf cocos2d-1.0.0-beta_templates.tar.gz

INSTALL (Option B):

  • Download “develop” branch from github
  • run the install script
$ cd cocos2d-iphone
$ git checkout develop
$ git pull
$ ./install-templates.sh -f -u

47 Responses to “cocos2d Xcode 4 templates”


  • Awesome! Thank you very much!

  • I have searched the internet everywhere for this solution! THANK YOU SOOOOOO MUCH!!!

  • This is just available for project templates. There’s no file templates :( But I’ve been waiting for that so long. Thanks so much :)

  • Thanks so much, i have been waiting for this~~

  • Just a quick note, on my install the path was Developer/Library etc, not the other way round. Maybe it is for others, I’m unsure of how the xcode installer works across systems.

    Great work btw, looking forward to trying them out in a sec!

  • awesome! thx much

  • Sweet! Thanks for all the hard work … templates installed no problem!

  • I’ve been waiting for this too. Thank you !

  • thank you very much for the templates!

  • As always, you are the man Riq! thanks for doing this.

  • It’s installed successfully thru the Option B. Thank you very much for the templates~ ;)

  • Hi, I’ve download these templates and I’m facing a problem I don’t know how to solve.
    If I create a sample new project with just Cocos2D, I can run it with no problem and behaves as expected, with te Hello World on the iPhone screen.
    But if I try to create a Box2D project, and try to run the sample, without changing anything, the complier fails. I’m not able to know what I’m supposed to change, in previous version of Xcode I ran the same test, and it worked with no problems.
    Xcode tells me there are 14 issues (like “No such file or directory in b2Shape.h”, i.e.)…. any help? Nobody has faced this problem??

  • Hi, Riq,

    Great help!
    How did you know to where to try out your copy & past to find the correct location?
    Is there any principle?

    Ivan

  • Getting the same problem as JRM with Option A, will try Option B.

  • I’m getting the box2d template error as well. Anyone?

  • Update to above comment: option B fixed the problem

  • JRM, I was having similar problems creating a new Box2D project under XCode 4. I have found a workaround:

    In each of the Box2D source files, change the #include paths from:

    #include

    to

    #include “b2Collision.h”

    It’s a bit of a pain in the ass because you have to go through every file and change it, but it will at least get the job done. It seems to be a bug in XCode4. This is the only workaround I have come up with.

    Suvlaki

  • Thank you very much¡ Riq, you are the best¡

  • When will File Templates be supported in XCode 4? Or how can we get them installed?
    Thanks :)

  • i have the same problem with the box2d.By the way, when would the mac templates come?

  • oh no,i test the cocos2d helloworld,but crash.here is the sonsole output:

    2011-03-28 11:16:21.021 testcoco[6110:207] cocos2d: compiled with Profiling Support: NO
    2011-03-28 11:16:21.030 testcoco[6110:207] cocos2d: surface size: 480×320
    [Switching to process 6110 thread 0x590b]
    [Switching to process 6110 thread 0x207]
    2011-03-28 11:16:21.050 testcoco[6110:207] cocos2d: Frame interval: 1
    LLVM ERROR: Cannot yet select: 0x78461d8: v16i8 = bit_convert 0x784d448 [ORD=199] [ID=170]
    0x784d448: v8i16 = X86ISD::PSHUFLW 0x784d228, 0x784d008 [ID=166]
    0x784d228: v8i16 = X86ISD::PSHUFHW 0x7845fb8, 0x784d008 [ID=162]
    0x7845fb8: v8i16 = llvm.x86.sse2.packssdw.128 0x7845f30, 0x7845ea8, 0x7845e20 [ORD=196] [ID=158]
    0x7845f30: i32 = Constant [ORD=196] [ID=21]
    0x7845ea8: v4i32 = bit_convert 0x7845d10 [ORD=195] [ID=139]
    0x7845d10: v4f32 = llvm.x86.sse.cmp.ps 0x7845c00, 0x784b770, 0x603adc0, 0x7845c88 [ORD=192] [ID=130]
    0x7845c00: i32 = Constant [ORD=192] [ID=19]
    0x784b770: v4f32 = X86ISD::PSHUFD 0x603adc0, 0x78472f0 [ID=121]
    0x603adc0: v4f32 = fadd 0x603ad38, 0x6034c08 [ORD=173] [ID=114]
    0x603ad38: v4f32 = fmul 0x784b3b8, 0x603acb0 [ORD=172] [ID=102]
    0x784b3b8: v4f32 = X86ISD::PSHUFD 0x60371e0, 0x78472f0 [ID=85]
    0x60371e0: v4f32,ch = load 0×6938574, 0×6035510, 0×6037598 [ORD=129] [ID=68]
    0×6938574: ch = EntryToken [ORD=117] [ID=0]
    0×6035510: i32 = add 0x60372f0, 0×6035378 [ORD=128] [ID=63]
    0x60372f0: i32,ch = CopyFromReg 0×6938574, 0×6035598 [ORD=117] [ID=44]
    is someone help me?

  • Hmmm weird, the Hello World App ran fine for me. Did you create it using the templates?

  • Is there an ETA on the Mac OS X templates?

  • Awesome!! Saved my day..

  • for file template you could do the following for now:

    copy the “cocos2d 1.0.0″ from /Library/Application Support/Developer/Shared/Xcode/file templates to /Developer/Library/XCode/Templates/File templates and then rename folders inside the cocos2d/CCNode Class folder from “*.pbfiletemplate” to “*.xctemplate”.

  • If someone needs I’m created template files.

    1. Download from “cocos2d_1.0.0.zip” https://files.me.com/miroslav.perovic/7despc
    2. copy the “cocos2d 1.0.0.zip″ to /Developer/Library/XCode/Templates/File templates and unpack it
    3. Run Xcode and add new template files in your application

    PS This is not official cocos2d template files.

  • what do you mean whit
    un-tar it and
    eg:

    $ mkdir -p ~/Library/Developer/Xcode/Templates
    $ cd ~/Library/Developer/Xcode/Templates
    $ tar xzvf cocos2d-1.0.0-beta_templates.tar.gz

    $ cd cocos2d-iphone
    $ git checkout develop
    $ git pull
    $ ./install-templates.sh -f -u
    where I write it

  • THANK YOU!!!

  • THX 4 help! Everything is running smoothly!!

  • I’m using now the Mac OS Lion, and in my case the correct path is: /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

    Thanks!

  • 1.Download the template .tar.gz: cocos2d-1.0.0-beta_templates.tar.gz
    2.mkdir ~/Library/Developer/Xcode/Templates
    3.untar template to Templates
    My Option
    Thanks

  • I used the Option (A) and the templates installed correctly in xcode4.

    Thanks!!

  • @mperovic

    Thanks for the file templates! Works perfectly!

  • Hi, All,

    I want to know, When we build and Archiving in xcode 4 with cocos2D project, it failed..

    So, have you any of got this error .?

    Project run successfully but not Build And Archiving…

    I cant archiving cocos project on xcode 4,
    Please let me know about this kind of issue…

  • Thanks a lot guys keep up the good work!

  • I tried option one and the templates didn’t get created for me :( I’m a little confused about option B. Any help?

  • Thank you so much! It works!! ^^

  • Thanks a lot. This is wonderful update. Save a lot of time for me.

  • Hi All, thanks for this useful template,

    i have a question i have an another project that combine tabbar, navigation and table view controller and my question is how to convert this project in a project template for reuse it in a future project without recreate all my files ???

    just like cocos2d template

    thx a lot for your help

  • Just FYI…

    It seems that when XCode updates it also backs up the Develop folder into one called Developer-old and then recreates a new one.

    If this happens you will need to copy the File Templates from the old one into the new one for it to work again.

    On mine the templates disappeared after a Software Update.

    Thanks!

  • well, thank you for the template.. ^_^, it was a nice work from you,….

    Oh yeah, I copied to my xcode 4.2 template directory, located in:

    ~/Developer/Library/Xcode/Templates/

    and it’s work well… :)

  • I’ve followed Pearapps tutorial but it wont work in xcode for ios5.0 when i try run i get 16issues how to solve this?

    pls add me on msn if you know a solution:
    maarten_holland_11@hotmail.com

Leave a Reply




Social Widgets powered by AB-WebLog.com.