How can I include cocos2d-x templates in Xcode?
Asked Answered
D

5

14

I'm trying to follow this guide which is often quoted as being an excellent tutorial for Cocos2d-x.

The problem is that my downloads for Cocos2d-x (2.2 and 3.0 alpha0) do not include the file the tutorial indicates, install-templates-xcode.sh.

Any idea what happened here? I did a search for that term, and nothing came up, so I'm assuming it's not hidden deeper in the files.

Out of frustration I downloaded cocos2d-iphone, and that folder clearly has the install-templates.sh file. I'd rather develop for multi-platform, but this simple issue is really bothering me. I simply want to be able to create an Xcode project and choose the cocos2d-x template (as is indicated in the tutorial I linked above).

See the github repositories:

Cocos2d-x

Cocos2d-iPhone

Notice the iPhone repository has the install-templates file.

Maybe I'm missing something obvious, which is usually the case. Regardless, help would be very appreciated.

Doubletalk answered 24/10, 2013 at 15:49 Comment(0)
S
24

It doesn't exist anymore. You need to use create_project.py inside tools/project-creator in terminal.

-> python create_project.py [params]

example:

-> python create_project.py -project MyGame -package com.MyCompany.AwesomeGame -language cpp

I know, it really sucks. But it's better for creating multi-platform projects.

Sargassum answered 24/10, 2013 at 19:16 Comment(3)
after created project, how can I open it?Chromato
Thanks for posting this! I had the exact same problem. Why would they remove the "install-templates-xcode.sh" file?Miceli
Can you please elaborate a little bit on how to use crate project.py ? I have same issue.Jaela
L
4

@marcg11's answer is valid for Cocos2d-x version 2.*. Script create_project.py doesn't exist in version 3.1 anymore. You should use "cocos" console instead.

E.g. In a terminal go to a folder you want to create your project in and run:

cocos new Cocos2DxFirstIosSample -l cpp -p org.cocos2d.Cocos2DxFirstIosSample

You may also specify other parameters:

$ cocos new --help
usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY]
                 [-t TEMPLATE_NAME] [--no-native]
                 [PROJECT_NAME]

Creates a new project

positional arguments:
  PROJECT_NAME          Set the project name

optional arguments:
  -h, --help            show this help message and exit
  -p PACKAGE_NAME, --package PACKAGE_NAME
                        Set a package name for project
  -l {cpp,lua,js}, --language {cpp,lua,js}
                        Major programming language you want to use, should be
                        [cpp | lua | js]
  -d DIRECTORY, --directory DIRECTORY
                        Set generate project directory for project
  -t TEMPLATE_NAME, --template TEMPLATE_NAME
                        Set the template name you want create from

lua/js project arguments:
  --no-native           No native support.
Lamdin answered 17/6, 2014 at 12:28 Comment(0)
T
3

The README.md file that comes with cocos2d-x v3.2 now says to use the cocos script to create new projects:

cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR

reference:

Teeter answered 2/9, 2014 at 4:18 Comment(0)
B
1

you can start with these templates: http://code4app.net/category/cocos2d

Bubbler answered 24/10, 2013 at 21:27 Comment(0)
P
1

Just take a look on this blog, its has very nice info even you can setup for Xcode 6(beta) also.

I have tested. But one drawback is there its for Cocos2d-x 2.0 version.

Paris answered 24/6, 2014 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.