issue #1399: Updated android template.

This commit is contained in:
James Chen 2012-07-23 14:56:40 +08:00
parent 9a6729551c
commit d5f783b681
4 changed files with 16 additions and 16 deletions

View File

@ -6,7 +6,7 @@ LOCAL_MODULE := hellocpp_shared
LOCAL_MODULE_FILENAME := libhellocpp
LOCAL_SRC_FILES := helloworld/main.cpp \
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp

View File

@ -5,7 +5,7 @@
APP_NAME=$2
COCOS2DX_ROOT=$1
APP_DIR=$COCOS2DX_ROOT/$APP_NAME
HELLOWORLD_ROOT=$COCOS2DX_ROOT/HelloWorld
HELLOWORLD_ROOT=$COCOS2DX_ROOT/samples/HelloCpp
COCOSJAVALIB_ROOT=$COCOS2DX_ROOT/cocos2dx/platform/android/java
NDK_ROOT=$3
PACKAGE_PATH=$4
@ -61,17 +61,17 @@ copy_build_native(){
# replace AndroidManifext.xml and change the activity name
# use sed to replace the specified line
modify_androidmanifest(){
sed "s/ApplicationDemo/$APP_NAME/;s/org\.cocos2dx\.application/$PACKAGE_PATH/" $HELLOWORLD_ROOT/proj.android/AndroidManifest.xml > $APP_DIR/proj.android/AndroidManifest.xml
sed "s/HelloCpp/$APP_NAME/;s/org\.cocos2dx\.hellocpp/$PACKAGE_PATH/" $HELLOWORLD_ROOT/proj.android/AndroidManifest.xml > $APP_DIR/proj.android/AndroidManifest.xml
}
# modify ApplicationDemo.java
# modify HelloCpp.java
modify_applicationdemo(){
convert_package_path_to_dir $PACKAGE_PATH
# rename APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java to
# APP_DIR/android/src/org/cocos2dx/application/$APP_NAME.java, change helloworld to game
sed "s/ApplicationDemo/$APP_NAME/;s/helloworld/game/;s/org\.cocos2dx\.application/$PACKAGE_PATH/" $APP_DIR/proj.android/src/org/cocos2dx/application/ApplicationDemo.java > $APP_DIR/proj.android/src/$PACKAGE_PATH_DIR/$APP_NAME.java
rm -fr $APP_DIR/proj.android/src/org/cocos2dx/application
# rename APP_DIR/android/src/org/cocos2dx/hellocpp/HelloCpp.java to
# APP_DIR/android/src/org/cocos2dx/hellocpp/$APP_NAME.java, change hellocpp to game
sed "s/HelloCpp/$APP_NAME/;s/org\.cocos2dx\.hellocpp/$PACKAGE_PATH/;s/hellocpp/game/" $APP_DIR/proj.android/src/org/cocos2dx/hellocpp/HelloCpp.java > $APP_DIR/proj.android/src/$PACKAGE_PATH_DIR/$APP_NAME.java
rm -fr $APP_DIR/proj.android/src/org/cocos2dx/hellocpp
}
modify_layout(){

View File

@ -7,27 +7,27 @@ NEED_LUA=$4
LOCAL_STATIC_LIBRARIES="LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static"
MODULES_TO_CALL="\$(call import-module,CocosDenshion/android) \$(call import-module,cocos2dx)"
LOCAL_SRC_FILES="LOCAL_SRC_FILES := helloworld/main.cpp \\
LOCAL_SRC_FILES="LOCAL_SRC_FILES := hellocpp/main.cpp \\
../../Classes/AppDelegate.cpp \\
../../Classes/HelloWorldScene.cpp"
if [ $NEED_BOX2D = "true" ];then
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" box2d_static"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,Box2D)"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/Box2D)"
fi
if [ $NEED_CHIPMUNK = "true" ]; then
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" chipmunk_static"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,chipmunk)"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/chipmunk)"
fi
if [ $NEED_LUA = "true" ]; then
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" cocos_lua_static"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,lua/proj.android/jni)"
LOCAL_SRC_FILES=$LOCAL_SRC_FILES" ../../../lua/cocos2dx_support/CCLuaEngine.cpp \\
../../../lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \\
../../../lua/cocos2dx_support/LuaCocos2d.cpp \\
../../../lua/cocos2dx_support/tolua_fix.c"
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,scripting/lua/proj.android/jni)"
LOCAL_SRC_FILES=$LOCAL_SRC_FILES" ../../../scripting/lua/cocos2dx_support/CCLuaEngine.cpp \\
../../../scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \\
../../../scripting/lua/cocos2dx_support/LuaCocos2d.cpp \\
../../../scripting/lua/cocos2dx_support/tolua_fix.c"
fi
cat > $FILE << EOF