天天看点

cocos2d-x 3.0rc2 一键打包各个平台运行 (超级方便)

首先你需要下载三个文件:分别是

android-ndk

android-sdk

ant

下载的位置可以随意:因为3.0rc2运行setup.py  自动搜索这三个文件

win32的cmd下面:

(1):cmd下找到cocos2d-x   3.0rc  目录,运行setup.py   文件:

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>:

C:\Users\Administrator>e:

E:\>cd  E:\cocos3.0rc\cocos2d-x-3.0rc2

E:\cocos3.0rc\cocos2d-x-3.0rc2>setup.py

Setting up cocos2d-x...

->Check environment variable COCOS_CONSOLE_ROOT

  ->Find environment variable COCOS_CONSOLE_ROOT...

    ->COCOS_CONSOLE_ROOT is found : E:\cocos3.0cr\cocos2d-x-3.0rc1\tools/cocos2d

-console/bin

  ->Remove directory "E:\cocos3.0cr\cocos2d-x-3.0rc1\tools\cocos2d-console\bin"

from PATH!

  ->Add directory "E:\cocos3.0rc\cocos2d-x-3.0rc2\tools\cocos2d-console\bin" int

o PATH succeed!

  ->Force update environment variable COCOS_CONSOLE_ROOT

    ->Succeed : COCOS_CONSOLE_ROOT=E:\cocos3.0rc\cocos2d-x-3.0rc2\tools\cocos2d-

console\bin

->Check environment variable NDK_ROOT

  ->Find environment variable NDK_ROOT...

    ->NDK_ROOT is found : E:\android_NDK\android-ndk-r9c

->Check environment variable ANDROID_SDK_ROOT

  ->Find environment variable ANDROID_SDK_ROOT...

    ->ANDROID_SDK_ROOT is found : E:\SDK_Eclipse\adt-bundle-windows-x86-20131030

\sdk

->Check environment variable ANT_ROOT

  ->Find environment variable ANT_ROOT...

    ->ANT_ROOT is found : E:\apache-ant-1.9.3\bin

Please restart the terminal or restart computer to make added system variables t

ake effect

E:\cocos3.0rc\cocos2d-x-3.0rc2>

下面就可以创建工程了:超级方便:

  直接运行cocos  new  (在运行cocos  new  之前你必须先关闭cmd   然后 重新启动cmd  )

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>e:

E:\>cd  E:\cocos3.0rc\cocos2d-x-3.0rc2

E:\cocos3.0rc\cocos2d-x-3.0rc2>cocos new

E:\cocos3.0rc\cocos2d-x-3.0rc2>python E:\cocos3.0rc\cocos2d-x-3.0rc2\tools\cocos

2d-console\bin\/cocos.py new

Runing command: new

usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY]

                 [-t TEMPLATE_NAME] [--no-native]

                 [PROJECT_NAME]

cocos new: error: argument -l/--language is required

E:\cocos3.0rc\cocos2d-x-3.0rc2>

下面我们来创建一个helloworld

cocos new HelloWorld -p com.cocos2d.org -l cpp -d ~/Text/code/

E:\cocos3.0rc\cocos2d-x-3.0rc2>python E:\cocos3.0rc\cocos2d-x-3.0rc2\tools\cocos

2d-console\bin\/cocos.py new HelloWorld  -p com.cocos2d.org -l cpp -d ~/Text/cod

e

Runing command: new

> Copy template into E:\cocos3.0rc\cocos2d-x-3.0rc2\~\Text\code\HelloWorld

> Copying cocos2d-x files...

> Rename project name from 'HelloCpp' to 'HelloWorld'

> Replace the project name from 'HelloCpp' to 'HelloWorld'

> Replace the project package name from 'org.cocos2dx.hellocpp' to 'com.cocos2d.

org'

E:\cocos3.0rc\cocos2d-x-3.0rc2>

下面我们来一键打包到各个平台:

例如android平台:

E:\cocos3.0rc\cocos22d-x 3.0rc2> cd  ~/Text/code/HelloWorld/

cocos2d-x 3.0rc2 一键打包各个平台运行 (超级方便)

是不是比以前更人性化了.....