diff --git a/HelloLua/android/build_native.sh b/HelloLua/android/build_native.sh old mode 100644 new mode 100755 index c688312cf1..f1130165e2 --- a/HelloLua/android/build_native.sh +++ b/HelloLua/android/build_native.sh @@ -1,29 +1,32 @@ -# set params -ANDROID_NDK_ROOT=/cygdrive/e/android-ndk-r5 -COCOS2DX_ROOT=/cygdrive/d/Work7/cocos2d-x -GAME_ROOT=$COCOS2DX_ROOT/HelloLua -GAME_ANDROID_ROOT=$GAME_ROOT/android -RESOURCE_ROOT=$GAME_ROOT/Resource - -# make sure assets is exist -if [ -d $GAME_ANDROID_ROOT/assets ]; then - rm -rf $GAME_ANDROID_ROOT/assets -fi - -mkdir $GAME_ANDROID_ROOT/assets - -# copy resources -for file in $RESOURCE_ROOT/* -do - if [ -d $file ]; then - cp -rf $file $GAME_ANDROID_ROOT/assets - fi - - if [ -f $file ]; then - cp $file $GAME_ANDROID_ROOT/assets - fi -done - -# build -$ANDROID_NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT $* - +# set params +ANDROID_NDK_ROOT=/cygdrive/e/android-ndk-r5 +COCOS2DX_ROOT=/cygdrive/d/Work7/cocos2d-x + +GAME_ROOT=$COCOS2DX_ROOT/HelloLua +GAME_ANDROID_ROOT=$GAME_ROOT/android +GAME_RESOURCE_ROOT=$GAME_ROOT/Resource + +# make sure assets is exist +if [ -d $GAME_ANDROID_ROOT/assets ]; then + rm -rf $GAME_ANDROID_ROOT/assets +fi + +mkdir $GAME_ANDROID_ROOT/assets + +# copy resources +for file in $GAME_RESOURCE_ROOT/* +do + if [ -d $file ]; then + cp -rf $file $GAME_ANDROID_ROOT/assets + fi + + if [ -f $file ]; then + cp $file $GAME_ANDROID_ROOT/assets + fi +done + +# build +pushd $ANDROID_NDK_ROOT +./ndk-build -C $GAME_ANDROID_ROOT $* +popd + diff --git a/HelloLua/android/jni/helloworld/Android.mk b/HelloLua/android/jni/helloworld/Android.mk index 9062a5b1dc..c104038dbd 100644 --- a/HelloLua/android/jni/helloworld/Android.mk +++ b/HelloLua/android/jni/helloworld/Android.mk @@ -24,8 +24,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \ # -L$(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries -lcurl \ # -lpng \ # -lxml2 \ -# -ljpeg \ -# -lskia +# -ljpeg # it is used for ndk-r5 # if you build with ndk-r4, comment it @@ -35,8 +34,7 @@ LOCAL_LDLIBS := -llog -lGLESv1_CM -llog -lz \ -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl \ -lpng \ -lxml2 \ - -ljpeg \ - -lskia + -ljpeg LOCAL_STATIC_LIBRARIES := libcocos2d libcocosdenshion liblua diff --git a/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java new file mode 100644 index 0000000000..0600ce0fb5 --- /dev/null +++ b/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -0,0 +1,51 @@ +package org.cocos2dx.lib; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.FontMetricsInt; + +public class Cocos2dxBitmap{ + public static void createTextBitmap(String content, int fontSize){ + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setTextSize(fontSize); + + FontMetricsInt fm = paint.getFontMetricsInt(); + int h = (int)Math.ceil(fm.descent - fm.ascent) + 2; + int w = (int)Math.ceil(paint.measureText(content, 0, content.length())); + + Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + canvas.drawText(content, 0, h, paint); + + initNativeObject(bitmap); + } + + private static void initNativeObject(Bitmap bitmap){ + byte[] pixels = getPixels(bitmap); + if (pixels == null){ + return; + } + + nativeInitBitmapDC(bitmap.getWidth(), bitmap.getHeight(), pixels); + } + + private static byte[] getPixels(Bitmap bitmap){ + if (bitmap != null){ + byte[] pixels = new byte[bitmap.getWidth() * bitmap.getHeight() * 4]; + ByteBuffer buf = ByteBuffer.wrap(pixels); + buf.order(ByteOrder.nativeOrder()); + bitmap.copyPixelsToBuffer(buf); + return pixels; + } + + return null; + } + + private static native void nativeInitBitmapDC(int width, int height, byte[] pixels); +} diff --git a/HelloLua/win32/HelloLua.win32.vcproj.user b/HelloLua/win32/HelloLua.win32.vcproj.user index 9a000abe2c..130183712e 100644 --- a/HelloLua/win32/HelloLua.win32.vcproj.user +++ b/HelloLua/win32/HelloLua.win32.vcproj.user @@ -9,14 +9,14 @@ Name="Debug|Win32" > diff --git a/cocos2d-win32.vc2008.sln b/cocos2d-win32.vc2008.sln index 6a1f185ccd..e813524ee2 100644 --- a/cocos2d-win32.vc2008.sln +++ b/cocos2d-win32.vc2008.sln @@ -25,6 +25,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua\win32\HelloLua.win32.vcproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}" ProjectSection(ProjectDependencies) = postProject {DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159} + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "lua\liblua.vcproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index 858e9d194a..473ca9fe4f 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -107,19 +107,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \ $(LOCAL_PATH)/platform/third_party/android/iconv \ $(LOCAL_PATH)/platform/third_party/android/libpng \ $(LOCAL_PATH)/platform/third_party/android/libxml2 \ - $(LOCAL_PATH)/platform/third_party/android/libjpeg \ - $(LOCAL_PATH)/platform/third_party/android/skia/core \ - $(LOCAL_PATH)/platform/third_party/android/skia/animator \ - $(LOCAL_PATH)/platform/third_party/android/skia/config \ - $(LOCAL_PATH)/platform/third_party/android/skia/effects \ - $(LOCAL_PATH)/platform/third_party/android/skia/images \ - $(LOCAL_PATH)/platform/third_party/android/skia/pdf \ - $(LOCAL_PATH)/platform/third_party/android/skia/ports \ - $(LOCAL_PATH)/platform/third_party/android/skia/svg \ - $(LOCAL_PATH)/platform/third_party/android/skia/text \ - $(LOCAL_PATH)/platform/third_party/android/skia/utils \ - $(LOCAL_PATH)/platform/third_party/android/skia/views \ - $(LOCAL_PATH)/platform/third_party/android/skia/xml + $(LOCAL_PATH)/platform/third_party/android/libjpeg LOCAL_CFLAGS := -DUSE_FILE32API diff --git a/cocos2dx/platform/third_party/win32/OGLES/EGL/eglplatform.h b/cocos2dx/platform/third_party/win32/OGLES/EGL/eglplatform.h index ef3a06f36d..7cea6b3554 100644 --- a/cocos2dx/platform/third_party/win32/OGLES/EGL/eglplatform.h +++ b/cocos2dx/platform/third_party/win32/OGLES/EGL/eglplatform.h @@ -115,7 +115,7 @@ typedef EGLNativeWindowType NativeWindowType; * handles are 64 bit types, then EGLint should be defined as a signed 64-bit * integer type. */ - #if defined(_WIN64) || __WORDSIZE == 64 +#if defined(_WIN64) || __WORDSIZE == 64 typedef khronos_int64_t EGLint; #else typedef khronos_int32_t EGLint; diff --git a/cocos2dx/platform/third_party/win32/OGLES/KHR/khrplatform.h b/cocos2dx/platform/third_party/win32/OGLES/KHR/khrplatform.h index 04a05b71dc..bc210288a7 100644 --- a/cocos2dx/platform/third_party/win32/OGLES/KHR/khrplatform.h +++ b/cocos2dx/platform/third_party/win32/OGLES/KHR/khrplatform.h @@ -26,7 +26,7 @@ /* Khronos platform-specific types and definitions. * - * $Revision: 1.4 $ on $Date: 2009/05/06 13:30:53 $ + * $Revision: 1.5 $ on $Date: 2010/06/03 16:51:55 $ * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos @@ -97,8 +97,8 @@ *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ - -#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) + +#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__) # if defined (_DLL_EXPORTS) # define KHRONOS_APICALL __declspec(dllexport) # else @@ -120,7 +120,7 @@ * This follows the return type of the function and precedes the function * name in the function prototype. */ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else diff --git a/cocos2dx/platform/third_party/win32/libraries/libEGL.dll.REMOVED.git-id b/cocos2dx/platform/third_party/win32/libraries/libEGL.dll.REMOVED.git-id index 91dc6d87db..4248596ac2 100644 --- a/cocos2dx/platform/third_party/win32/libraries/libEGL.dll.REMOVED.git-id +++ b/cocos2dx/platform/third_party/win32/libraries/libEGL.dll.REMOVED.git-id @@ -1 +1 @@ -d501b155a2f81592835224d5cbd4f348438b5d9d \ No newline at end of file +b3c91670e8921218c2c6b169a95c5b9b5edae87c \ No newline at end of file diff --git a/cocos2dx/platform/third_party/win32/libraries/libgles_cm.dll.REMOVED.git-id b/cocos2dx/platform/third_party/win32/libraries/libgles_cm.dll.REMOVED.git-id index 8b5526f68b..0edeb2d168 100644 --- a/cocos2dx/platform/third_party/win32/libraries/libgles_cm.dll.REMOVED.git-id +++ b/cocos2dx/platform/third_party/win32/libraries/libgles_cm.dll.REMOVED.git-id @@ -1 +1 @@ -1672304b77b25dcb9c0dfdf8abb8e7d0ffe02427 \ No newline at end of file +9682d6c6192560740fbcc514f1700f431c02041d \ No newline at end of file diff --git a/cocos2dx/platform/third_party/win32/third_party_versions.txt b/cocos2dx/platform/third_party/win32/third_party_versions.txt index d5bf78ca39..126396b119 100644 --- a/cocos2dx/platform/third_party/win32/third_party_versions.txt +++ b/cocos2dx/platform/third_party/win32/third_party_versions.txt @@ -2,5 +2,5 @@ iconv 1.9.2 libjpeg 8b libpng 1.4.5beta04 libxml2 2.7.7 -OGLES 2.07.27.0484 +OGLES 2.08.28.0634 zlib 1.2.5 diff --git a/cocos2dx/proj.airplay/cocos2dx.mkf b/cocos2dx/proj.airplay/cocos2dx.mkf index 8a721d1d5c..93afc90cf4 100644 --- a/cocos2dx/proj.airplay/cocos2dx.mkf +++ b/cocos2dx/proj.airplay/cocos2dx.mkf @@ -6,16 +6,16 @@ defines AIRPLAY = 1 CC_UNDER_AIRPLAY = 1 } - + options -{ - module_path="../platform/third_party/airplay/" -} - +{ + module_path="../platform/third_party/airplay/" +} + subprojects -{ - zlib - expat +{ + zlib + expat } includepaths { @@ -91,6 +91,10 @@ files [platforms/airplay] "*.h" "*.cpp" + + ("../script_support") + [script_support] + "*.cpp" ("../sprite_nodes") [sprite_nodes] @@ -98,15 +102,15 @@ files ("../support") [support] - "base64.cpp" - "base64.h" - "CCArray.cpp" - "CCPointExtension.cpp" - "CCProfiling.cpp" - "CCProfiling.h" - "ccUtils.cpp" - "ccUtils.h" - "TransformUtils.cpp" + "base64.cpp" + "base64.h" + "CCArray.cpp" + "CCPointExtension.cpp" + "CCProfiling.cpp" + "CCProfiling.h" + "ccUtils.cpp" + "ccUtils.h" + "TransformUtils.cpp" "TransformUtils.h" ("../support/data_support") diff --git a/generate_xcode4_templates.sh b/generate_xcode4_templates.sh index c333fa08a8..7e4e7541c3 100755 --- a/generate_xcode4_templates.sh +++ b/generate_xcode4_templates.sh @@ -1,17 +1,17 @@ echo "generating libcocos2dx" mkdir -p template/xcode4/lib_cocos2dx.xctemplate -python ./template/xcode4/template_generator.py --directory cocos2dx --identifier libcocos2dx --prefix libs --exclude "android win32 airplay wophone third_party CCImage.cpp Android.mk" > ./template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist +python ./tools/template_generator.py --directory cocos2dx --identifier libcocos2dx --prefix libs --exclude "android win32 airplay wophone third_party CCImage.cpp CCFileUtils.cpp Android.mk" > ./template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist echo "generating libcocosdenshion" mkdir -p template/xcode4/lib_cocosdenshion.xctemplate -python ./template/xcode4/template_generator.py --directory CocosDenshion --identifier libcocosdenshion --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_cocosdenshion.xctemplate/TemplateInfo.plist +python ./tools/template_generator.py --directory CocosDenshion --identifier libcocosdenshion --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_cocosdenshion.xctemplate/TemplateInfo.plist echo "generating libbox2d" mkdir -p template/xcode4/lib_box2d.xctemplate -python ./template/xcode4/template_generator.py --directory Box2D --identifier libbox2d --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_box2d.xctemplate/TemplateInfo.plist +python ./tools/template_generator.py --directory Box2D --identifier libbox2d --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_box2d.xctemplate/TemplateInfo.plist echo "generating libchipmunk" mkdir -p template/xcode4/lib_chipmunk.xctemplate -python ./template/xcode4/template_generator.py --directory chipmunk --identifier libchipmunk --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_chipmunk.xctemplate/TemplateInfo.plist +python ./tools/template_generator.py --directory chipmunk --identifier libchipmunk --prefix libs --exclude "android win32 airplay wophone Android.mk" > ./template/xcode4/lib_chipmunk.xctemplate/TemplateInfo.plist echo "done" \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index e4f814cb2f..0bf1928fdf 100644 --- a/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -d1962bc646d8650f27302fd6c32dff2d9d4ab6a5 \ No newline at end of file +58728dc0be18955fcaabb9d6cd2ead3fdf389132 \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index 00ac984a78..ce4b99de99 100644 --- a/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -6c636339fa5aff82bfca50d9da220b50af5c0053 \ No newline at end of file +f04508231e03751a17872c963c91f97e4335132a \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index 3ca1cbb68a..754a4eabba 100644 --- a/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -0a09e265a353ec809a147d63541176ab261026fd \ No newline at end of file +62513e048519ce58a6a7b19d444f751b0e6ae9a4 \ No newline at end of file diff --git a/template/xcode4/template_generator.py b/tools/template_generator.py similarity index 100% rename from template/xcode4/template_generator.py rename to tools/template_generator.py