天天看點

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 一鍵打包各個平台運作 (超級友善)

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