🥥 Installing Cocos2D-x
Updated at 2015-03-11 02:57
Windows
- Install for Windows and Android builds:
- Python 2.7., check with
python --version
. - JDK 1.7, check with
java -version
. - Visual Studio 2012
- Microsoft .NET Framework 4 Client Profile,
- Microsoft Access Database Engine 2010 Redistributable,
- Android SDK,
- Android NDK,
- Apache Ant
- Python 2.7., check with
- Download and unzip Cocos2d-x 3.4 somewhere.
# Configure environmental variables. cd /path/to/cocos2d-x python setup.py
Remember that you need to restart command-line tool each time you change environmental variables. Changing Java env variables also might require full reboot.
- Create a project.
# Create a multi-platform project. # Open command-line at the directory you want to contain "MyGame" directory. cocos new MyGame -p com.MyCompany.MyGame -l cpp
# Run it cd /path/to/MyGame cocos run -p win32 # or add source path with `-s /path/to/projects/MyCompany/MyGame` # All available platforms: android, ios, win32, mac, linux
Mac
- Install:
- XCode through AppStore for editing and iOS/Mac building.
- Android NDK, Android SDK, Apache Ant and Java for Android development for Android building.
- Download and unzip Cocos2d-x 3.4 somewhere.
# Add following to ~/.bash_profile, ~/.bash_login or ~/.profile export NDK_ROOT=/path/to/android-ndk export ANDROID_SDK_ROOT=/path/to/android-sdk export ANT_HOME=/path/to/ant export ANT_OPTS=-Xmx256M export ANT_ROOT=$ANT_HOME/bin export COCOS_X_ROOT=/path/to/cocos2d-x-3.4 export COCOS_TEMPLATES_ROOT=/path/to/cocos2d-x-3.4/templates export COCOS_CONSOLE_ROOT=/path/to/cocos2d-x-3.4/tools/cocos2d-console export PATH=$COCOS_CONSOLE_ROOT:$ANT_ROOT:$PATH
- Create project.
# Create a multi-platform project. # Open command-line at the directory you want to contain "MyGame" directory cd /path/to/projects cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ~/MyCompany
# Run it cd MyGame cocos run -p mac # or add source path with `-s /path/to/projects/MyCompany/MyGame` # All available platforms: android, ios, win32, mac, linux # You can also run on Mac using XCode play.