如何在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:11:03  来源:igfitidea点击:

How can I include cocos2d-x templates in Xcode?

xcodetemplatescocos2d-iphonecocos2d-x

提问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 存储库:

Cocos2d-x

Cocos2d-x

Cocos2d-iPhone

Cocos2d-iPhone

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.pydoesn't exist in version 3.1anymore. You should use "cocos"console instead.

@marcg11 的回答对 Cocos2d-x版本 2.* 有效。脚本create_project.py3.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.mdfile that comes with cocos2d-x v3.2 now says to use the cocos script to create new projects:

README.mdcocos2d-x v3.2 附带的文件现在说使用 cocos 脚本创建新项目:

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

reference:

参考:

回答by Muhammad Rizwan

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

看看这个博客,它有非常好的信息,即使你也可以为 Xcode 6(beta) 设置。

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

我已经测试过了。但一个缺点是 Cocos2d-x 2.0 版本。

回答by Yossi

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

你可以从这些模板开始:http: //code4app.net/category/cocos2d