6/23/2014

[Cocos2d-x] 在 Mac 上設置 Cocos2d-x (Cocos2d-x 3 .x)



環境 OSX 10.9 , Cocos2d-x 3.2

下載Cocos2d-x http://cocos2d-x.org/download

JAVA http://www.oracle.com/technetwork/java/javase/downloads/index.html
安裝 AndroidSDK+ADT(android) http://developer.android.com/sdk/index.html
SDK要用2.3.3 其它會報錯

NDK http://developer.android.com/tools/sdk/ndk/index.html

安裝 Ant
終端機
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
$ brew update
$ brew install ant



設置cocos2d-x
終端機
到cocos2d-x 解開的目錄下
$ python setup.py
輸入android sdk, ndk, ant的目錄
$ source /Users/[osx user name]/.bash_profile


建立Project

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

就可以去目錄下開 xcode 專案來 run 了





其它參考指令
Build and run new project for android
$ cocos run -p android -j 4

Build and run new project for iOS
$ cocos run -p ios
Build and run new project for OSX
$ cocos run -p mac
Build and run new project for linux
if you never run cocos2d-x on linux, you need to install all dependences by the script in cocos2d/build/install-deps-linux.sh
$ cd cocos2d-x/build
$ ./install-deps-linux.sh
Then
$ cd NEW_PROJECTS_DIR/MyGame
$ cocos run -p linux
Run
$ bin/MyGame

Build and run new project for win32
$ cocos run -p win32


沒有留言:

張貼留言