首先 python 要升级到 2.7 以上...我之前是2.6所以命令总是执行失败...
cocos new filename -p package -l language -d DIRECTORY -t TEMPLATE_NAME --ios-bundleid IOS_BUNDLEID --mac-bundleid MAC_BUNDLEID
这是所有的命令参数...但是要创建 2012 的工程,可以不用写完..
大致这样就可以了..
例子1: cocos new Test -l cpp -p com.xxx.Test -d D:\工程目录\
例子2: cocos new MyGame -p com.your_company.mygame -l cpp -d /home
关于 -p com.xxx.Tes 这个东西. .. package name for android .. 我的理解就是安装到手机上用..保证安装的文件在手机上目录不会重复...只要是唯一的就好.
------------------------------华丽的分割线------------------------------------------------------------------------
另外想方便的方法..可以做个.bat 的文件....参考了下网上别个写的bat
原文目录: http://blog.csdn.net/shi_weihappy/article/details/25083381
将下面的代码拷贝到文本文件中,重命名文件为 cocos3.0创建工程.bat
@echo offecho -------------------------create project with python----------------------------- set /p project_name= "Please enter your project name [for example: Runner] : "echo --------your project name : %project_name%set /p package_name= "Please enter your package name [for example: com.firedragonpzy.roy ] : "echo --------your package name : %package_name%set /p language_type= "Please enter your language types [cpp | javascript | lua] : "echo --------your language types : %language_type%set directory_path=e:\cocoSampleecho --------your project directory : %directory_path%set temp_path=\tools\cocos2d-console\binset project_path=%cd%%temp_path%cd %project_path%::E:\cocos2d-x-3.0\cocos2d-x-3.0\tools\cocos2d-console\bin\cocos.py 0.2 - cocos console: A command line tool for cocos2d
::Available commands:
:: compile Compiles the current project to binary
:: new Creates a new project
:: run Compiles & deploy project and then runs it on the target
:: jscompile minifies and/or compiles js files
:: deploy Deploy a project to the target
::Example:
:: E:\cocos2d-x-3.0\cocos2d-x-3.0\tools\cocos2d-console\bin\cocos.py new --help
:: E:\cocos2d-x-3.0\cocos2d-x-3.0\tools\cocos2d-console\bin\cocos.py run --help::E:\cocos2d-x-3.0\cocos2d-x-3.0\tools\cocos2d-console\bin>cocos.py new --help
:: usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME]
:: Creates a new project
:: positional arguments: PROJECT_NAME Set the project name
:: optional arguments:
:: -h, --help show this help message and exit
:: -p PACKAGE_NAME, --package PACKAGE_NAME
:: Set a package name for project
:: -l {cpp,lua,js}, --language {cpp,lua,js}
:: Major programming language you want to use, should be [cpp | lua | js]
:: -d DIRECTORY, --directory DIRECTORY
:: Set generate project directory for project
:: -t TEMPLATE_NAME, --template TEMPLATE_NAME
:: Set the template name you want create from
::lua/js project arguments:
:: --no-native No native support.set temp_path=\cocos.py new -p %package_name% -l %language_type% -d %directory_path% %project_name%set last=%project_path%%temp_path%%last%pause
修改
set directory_path=e:\cocoSample
为自己的工程目录就可以了...