如何在 Xcode 中包含 cocos2d-x 模板?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19570677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I include cocos2d-x templates in Xcode?
提问by Rail24
I'm trying to follow thisguide which is often quoted as being an excellent tutorial for Cocos2d-x.
我正在尝试遵循这个指南,它经常被引用为 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.
问题是我下载的 Cocos2d-x(2.2 和 3.0 alpha0)不包含教程指示的文件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.shfile. 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).
出于沮丧,我下载了 cocos2d-iphone,该文件夹显然包含install-templates.sh文件。我宁愿为多平台开发,但这个简单的问题真的困扰着我。我只是希望能够创建一个 Xcode 项目并选择 cocos2d-x 模板(如我上面链接的教程中所示)。
See the github repositories:
查看 github 存储库:
Notice the iPhone repository has the install-templates file.
请注意 iPhone 存储库具有 install-templates 文件。
Maybe I'm missing something obvious, which is usually the case. Regardless, help would be very appreciated.
也许我遗漏了一些明显的东西,这通常是这种情况。无论如何,帮助将不胜感激。
回答by marcg11
It doesn't exist anymore. You need to use create_project.pyinside tools/project-creator in terminal.
它不存在了。您需要在终端中的 tools/project-creator 中使用create_project.py。
-> 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.
我知道,这真的很糟糕。但它更适合创建多平台项目。
回答by dmitri
@marcg11's answer is valid for Cocos2d-x version 2.*. Script create_project.py
doesn't exist in version 3.1anymore. You should use "cocos"console instead.
@marcg11 的回答对 Cocos2d-x版本 2.* 有效。脚本create_project.py
在3.1 版中不再存在。您应该改用“cocos”控制台。
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.
回答by EMebane
The README.md
file that comes with cocos2d-x v3.2 now says to use the cocos script to create new projects:
README.md
cocos2d-x v3.2 附带的文件现在说使用 cocos 脚本创建新项目:
cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
reference:
参考:
回答by Muhammad Rizwan
回答by Yossi
you can start with these templates: http://code4app.net/category/cocos2d
你可以从这些模板开始:http: //code4app.net/category/cocos2d