Xcode运行程序
1.下载安装cocos2d-x-3.6
从官网下载cocos2d-x-3.6.zip,解压后是,命令行进入到此目录中,安装运行setup.py,运行干了什么,如图:
最后的结果是,vim ~/.bash_profile
#cocos start # Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x #export COCOS_CONSOLE_ROOT=/Users/apple/Soft/dev/cocos2d-x-3.9/tools/cocos2d-console/bin export COCOS_CONSOLE_ROOT=/Users/apple/Soft/dev/cocos2d-x-3.11.1/tools/cocos2d-console/bin export PATH=$COCOS_CONSOLE_ROOT:$PATH # Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x #export COCOS_TEMPLATES_ROOT=/Users/apple/Soft/dev/cocos2d-x-3.9/templates export COCOS_TEMPLATES_ROOT=/Users/apple/Soft/dev/cocos2d-x-3.11.1/templates export PATH=$COCOS_TEMPLATES_ROOT:$PATH # Add environment variable ANT_ROOT for cocos2d-x export ANT_ROOT=/Users/apple/Soft/dev/apache-ant-1.9.7/bin export PATH=$ANT_ROOT:$PATH #sdk export ANDROID_SDK_ROOT=/Users/apple/Soft/dev/adt-bundle-mac-x86_64-20140702/sdk export PATH=$ANDROID_SDK_ROOT:$PATH #ndk export NDK_ROOT=/Users/apple/Soft/dev/android-ndk-r10e export PATH=$NDK_ROOT:$PATH #cocos end
cocos2dx-3.10配置
# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x export COCOS_CONSOLE_ROOT=/Users/ouyang/DevRes/cocos2d-x-3.10/tools/cocos2d-console/bin export PATH=$COCOS_CONSOLE_ROOT:$PATH # Add environment variable COCOS_X_ROOT for cocos2d-x export COCOS_X_ROOT=/Users/ouyang/DevRes export PATH=$COCOS_X_ROOT:$PATH # Add environment variable COCOS_TEMPLATES_ROOT for cocos2d-x export COCOS_TEMPLATES_ROOT=/Users/ouyang/DevRes/cocos2d-x-3.10/templates export PATH=$COCOS_TEMPLATES_ROOT:$PATH #ANT_ROOT #export ANT_ROOT=/Applications/Cocos/tools/ant/bin #export PATH=$ANT_ROOT:$PATH #NDK_ROOT export NDK_ROOT=/Users/ouyang/DevCocos/android-ndk-r10e export PATH=$NDK_ROOT:$PATH #ANDROID_SDK_ROOT export ANDROID_SDK_ROOT=/Users/ouyang/DevCocos/sdk export PATH=$ANDROID_SDK_ROOT:$PATH export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH
2.编译运行cocos2d_tests程序
进入cocos2d-x-3.6文件夹——build双击打开那个cocos2d_tests.Xcodeproj进入Xcode界面。
这里要选择执行cpp-tests iOS并选择一个模拟器,然后运行,时间不短,请耐心等候。
编译效果图:
运行效果图:
3.新建项目game_test
命令行进入到目录:cocos2d-x-3.6/tools/cocos2d-console/bin,执行下面命令:
python cocos.py new game_test -p com.test.app -l cpp -d /Users/ouyang/test_work/
效果图:
这部分跟[cocos2dx]在windows7下搭建Cocos2D-X win32开发环境 一样。
CocosCodeIDE运行程序
1.下载安装并配置
在官网下载cocos-code-ide-2.0.0-beta.dmg并安装后,配置如下
2.新建工程,并运行
新建工程,如下图,一步一步下去
运行效果图:
本文参考,[cocos2dx]在windows7下搭建Cocos2D-X win32开发环境和[cocos2dx]Cocos Code IDE使用教程