iOS | Mac | Linux | Win32 | Android | Win8.1-Universal | |
---|---|---|---|---|---|---|
v3 | ||||||
v4 |
cocos2d-x is a multi-platform framework for building 2d games, interactive books, demos and other graphical applications. It is based on cocos2d-iphone, but instead of using Objective-C, it uses C++. It works on iOS, Android, Windows Phone and Store Apps, OS X, Windows, Linux and Web platforms.
Cocos2d-x Framework Architecture:
cocos2d-x is:
- Fast
- Free
- Easy to use
- Community supported
-
Clone the repo from GitHub.
$ git clone https://github.com/cocos2d/cocos2d-x.git
-
After cloning the repo, please execute
download-deps.py
to download and install dependencies.$ cd cocos2d-x cocos2d-x $ python download-deps.py
-
After running
download-deps.py
.cocos2d-x $ git submodule update --init
- Download the code from cocos2d download site
- Run
setup.py
- Run the
cocos
script
Example:
$ cd cocos2d-x
$ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE
$ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
$ cd NEW_PROJECTS_DIR/MyGame
You can also create a JS project or Lua project with -l js
or -l lua
.
$ cocos run -p android -j 4
$ cocos run -p ios
$ cocos run -p mac
If you never run cocos2d-x on Linux, you need to install all dependencies by the script in cocos2d/build/install-deps-linux.sh
$ cd cocos2d-x/build
$ ./install-deps-linux.sh
Then
< 8000 div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cd NEW_PROJECTS_DIR/MyGame $ cocos run -p linux">$ cd NEW_PROJECTS_DIR/MyGame
$ cocos run -p linux