cocos2d-x 已经到了3.0的版本。这次更新较之前,可以说是很大了。
一、这次不用安装到XCode上而是直接在控制台上创建工程。步骤如下
1、先到官网下载个3.0的包。
2、我下载的是测试版 cocos2d-x-3.0alpha0,
3、然后打开终端 cd 到 cocos2d-x-3.0alpha0目录
4、然后运行以下命令来创建工程
./create-multi-platform-projects.py -p <PROJECT_NAME> -k <PACKAGE_NAME> -l <cpp|lua|javascript>
<PROJECT_NAME>
<PACKAGE_NAME>
<cpp|lua|javascript>
这3个替换成你需要的,如下
./create-multi-platform-projects.py -p HelloWorld -k com.MyCompany.HelloWorld -l cpp
运行后,工程会创建在cocos2d-x-3.0alpha0下的projects目录里。
注意事项:
1、如果你不小安装之前的方式安装在控制台输入./install-deps-linux.sh那么你就把这个当前这个3.0的文件夹删掉吧。不然即使你创建完工程也会出错。
错误如下:
clang: error: no such file or directory: '/Users/tokou/Library/Developer/Xcode/DerivedData/HelloCpp-bjyxwvdvsmprtlejjmzkzhesieuy/Build/Products/Debug-iphonesimulator/libbox2d iOS.a'
clang: error: no such file or directory: '/Users/tokou/Library/Developer/Xcode/DerivedData/HelloCpp-bjyxwvdvsmprtlejjmzkzhesieuy/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a'
clang: error: no such file or directory: '/Users/tokou/Library/Developer/Xcode/DerivedData/HelloCpp-bjyxwvdvsmprtlejjmzkzhesieuy/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a'
clang: error: no such file or directory: '/Users/tokou/Library/Developer/Xcode/DerivedData/HelloCpp-bjyxwvdvsmprtlejjmzkzhesieuy/Build/Products/Debug-iphonesimulator/libcocos2dx-extensions iOS.a'
clang: error: no such file or directory: '/Users/tokou/Library/Developer/Xcode/DerivedData/HelloCpp-bjyxwvdvsmprtlejjmzkzhesieuy/Build/Products/Debug-iphonesimulator/libCocosDenshion iOS.a'
解决这个问题只要重新解压一个新3.0就好!!之后直接创建工程。
补充:3.0 alpha1 版创建工程:
进入路径
cd /Users/tokou/work/work_space/cocos2d-x-3.0alpha1/tools/project-creator
./create_project.py -p Test -k com.ldci.test -l lua
2.2.1
./create_project.py -project Test -package com.ldci.test -language lua
3.0Beta2
./create_project.py -n HelloWorld -k com.MyCompany.HelloWorld -l cpp -p /Users/tokou/WORK/5-Cocos2dx/Project
3.0RC2 cd /Users/用户名/WORK/5-Cocos2dx/cocos2d-x-3.0rc2/tools/cocos2d-console/bin
python cocos.py new XYOL_HD_COCOS -l cpp -p com.hytc.xyolhd -d /Users/tokou/WORK/5-Cocos2dx/Project