发布于 2016-04-13 01:43:53 | 142 次阅读 | 评论: 1 | 来源: 网友投递
Cocos2d-x
Cocos2d-x是一个开源的移动2D游戏框架,MIT许可证下发布的。这是一个C++ Cocos2d-iPhone项目的版本。Cocos2d-X发展的重点是围绕Cocos2d跨平台,Cocos2d-x提供的框架。手机游戏,可以写在C++或者Lua中,使用API是Cocos2d-iPhone完全兼容。Cocos2d-x项目可以很容易地建立和运行在iOS,Android,黑莓Blackberry等操作系统中。
# set params
NDK_ROOT_LOCAL=/cygdrive/c/android-ndk-r8d
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d-2.0-x-2.0.3
buildexternalsfromsource=
usage(){
cat << EOF
usage: $0 [options]
Build C/C++ native code using Android NDK
OPTIONS:
-s Build externals from source
-h this help
EOF
}
while getopts "s" OPTION; do
case "$OPTION" in
s)
buildexternalsfromsource=1
h)
usage
exit 0
esac
done
# try to get global variable
if [ $NDK_ROOT"aaa" != "aaa" ]; then
echo "use global definition of NDK_ROOT: $NDK_ROOT"
NDK_ROOT_LOCAL=$NDK_ROOT
fi
if [ $COCOS2DX_ROOT"aaa" != "aaa" ]; then
echo "use global definition of COCOS2DX_ROOT: $COCOS2DX_ROOT"
COCOS2DX_ROOT_LOCAL=$COCOS2DX_ROOT
fi
HELLOWORLD_ROOT=$COCOS2DX_ROOT_LOCAL/TestCocos/proj.android
# make sure assets is exist
if [ -d $HELLOWORLD_ROOT/assets ]; then
rm -rf $HELLOWORLD_ROOT/assets
fi
mkdir $HELLOWORLD_ROOT/assets
# copy resources
for file in $COCOS2DX_ROOT_LOCAL/TestCocos/Resources/*
do
if [ -d $file ]; then
cp -rf $file $HELLOWORLD_ROOT/assets
fi
if [ -f $file ]; then
cp $file $HELLOWORLD_ROOT/assets
fi
done
if [[ $buildexternalsfromsource ]]; then
echo "Building external dependencies from source"
$NDK_ROOT_LOCAL/ndk-build -C $HELLOWORLD_ROOT $* \
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/source
else
echo "Using prebuilt externals"
$NDK_ROOT_LOCAL/ndk-build -C $HELLOWORLD_ROOT $* \
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/prebuilt
fi
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp
static {
System.loadLibrary("game");
}