Developers Manual > Cocos2d-x > Cocos2d-console > Cocos new

cocos new

Overview

Create a new -x or -js project.

Usage

cocos new -l {cpp,lua,js} [arguments] [PROJECT_NAME]

Available Arguments

arg available value sample description necessary
-h, --help - - Show the help message and exit no
-p, --package string match *.*.* com.company.pkgname Set a package name for project. Default is same with template no
-l, --language {cpp, lua, js} lua Major programming language you want to use. yes
-d, --directory a absolute(relative) path ./projects/ Set generate project directory for project. Default is current directory no
-t, --template a string of template name default Set the template name you want create from. Default value is default no
-e, --engine-path a absolute(relative) path /Users/CurrentUser/cocos2d-x Set the path of cocos2d-x/cocos2d-js engine. no
--mac-bundleid a string of mac bundle id com.company.macbundleid Set a bundle id for mac project. Default is same with template no
--ios-bundleid a string of ios bundle id com.company.iosbundleid Set a bundle id for ios project. Default is same with template no
--portrait - - Set the project be portrait. no

Attentions

The logic of looking for template is:
1. Generate the template folder name with [language]-template-[template name].
For example: The template folder name of cocos new -l lua -t runtime is lua-template-runtime
2. Find the template folder in the templates directory of engine.

Samples

  • cocos new -h. Show the help message like this: new help
  • cocos new -l lua -p org.cocos2dx.mygame -d ./projects MyLuaGame
    The properties of the created project is:
    • package name is org.cocos2dx.mygame
    • target directory is ./projects
    • project name is MyLuaGame

help_new.jpg (110.9 kB) zhangbin@cocos2d-x.org, 2014-06-16 02:48

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.