How to Start a New Cocos2d-x Game
This documentation will show you how to usecocos consoleto create and run a new project.
Runtime Requirements
- Android 2.3+
- iOS 5.0+
- OS X 10.7+
- Windows 7+
- Ubuntu 12.04+
- Cocos2d-x v3.0+
Software Requirements
- Xcode 4.6 (for iOS or Mac)
- gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required.
- Visual Studio 2012 (for Windows)
- Python 2.7.5
Create A New Project
-
MyGame
: name of your project -
-p com.MyCompany.MyGame
: package name for android -
-l cpp
: programming language used for the project,valid value iscpp
andlua
-
-d ~/MyCompany
: directory to hold your project
Folder structure of the generated project is as following:
(Note: The directory may be different when the project type is lua.)
Build And Run New Project
-
-s
: directory of the new project. This could be an absolute path or a relative path. -
-p
: which platform to run on. Options areios
,android
,249)">win32,249)">macandlinux
.
(Note: You are a tmux user,you should addreattach-to-user-namespace
before the commandcocos
. For more information,please refer tothis linkfor more information.)
You can runcocos run --help
for more detail information.
For Win32 Users
usingcmd
as your shell:cd cocos2d-x-3.1.1\tools\cocos2d-console\bin
or to wherever you have this on your filesystem
Then execute something like:cocos.py new YourGameTitle -p com.yourcompany.gametitle -l cpp -d C:\YourGameTitle
For Linux Users
The process should be the same.