一、下载资源工具
1、下载cocos2d-x 3.0 官网地址:http://www.cocos2d-x.org/filedown/cocos2d-x-3.0-cn
2、下载VS2012 地址网上搜一下非常多
3、下载adt-bundle-windows 和 ndk (NDK据说要下载最新的r9d版本号)
4、下载ant 官网:
5、下载python 2.7 ,新版本号多人说不合用
二、開始操作
1、安装软件 VS2012 、 sdk、 ndk 、 ant 、 python
2、cocos2d-x 3.0 直接解压到指定文件夹就可以,无需安装
3、配置环境变量:jdk 环境变量、NDK_ROOT 、ANDROID_SDK_ROOT、ANT_ROOT
将ant bin 和 python bin 加入到path路径中。方便使用
4、执行cocos2d-x-3.0 下的setup.py 初始化检查cocos2d-x环境变量
三、经常使用指令
1、cocos new 创建project
usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME]Creates a new projectpositional arguments: PROJECT_NAME Set the project nameoptional 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 fromlua/js project arguments: --no-native No native support.usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME]Creates a new projectpositional arguments: PROJECT_NAME Set the project nameoptional 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 fromlua/js project arguments: --no-native No native support.
2、使用 cocos compile 编译project
usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--no-native] [PROJECT_NAME]Creates a new projectpositional arguments: PROJECT_NAME Set the project nameoptional 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 fromlua/js project arguments: --no-native No native support.
四、错误
在编译的时候,发现总算编译出错。发现时ndk所在文件夹为D:\Program Files 下由于路径中有空格,编译命令运行时总是出错。将ndk的地址更换后,正常编译