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 |
Attentions
- The
cocos2d-console
incocos2d-x
can only create project with language iscpp
orlua
- The
cocos2d-console
incocos2d-js
can only create project with language isjs
- The logic of looking for template is:
- Generate the template folder name with
[language]-template-[template name]
.
For example: The template folder name ofcocos new -l lua -t runtime
islua-template-runtime
- Find the template folder in the
templates
directory of engine.
- Generate the template folder name with
Samples
cocos new -h
. Show the help message like this: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
- package name is