mirror of https://github.com/axmolengine/axmol.git
Merge https://github.com/cocos2d/cocos2d-x into iss364
This commit is contained in:
commit
53eafa77ff
|
@ -1,9 +1,10 @@
|
|||
# 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
|
||||
GAME_RESOURCE_ROOT=$GAME_ROOT/Resource
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d $GAME_ANDROID_ROOT/assets ]; then
|
||||
|
@ -13,7 +14,7 @@ fi
|
|||
mkdir $GAME_ANDROID_ROOT/assets
|
||||
|
||||
# copy resources
|
||||
for file in $RESOURCE_ROOT/*
|
||||
for file in $GAME_RESOURCE_ROOT/*
|
||||
do
|
||||
if [ -d $file ]; then
|
||||
cp -rf $file $GAME_ANDROID_ROOT/assets
|
||||
|
@ -25,5 +26,7 @@ do
|
|||
done
|
||||
|
||||
# build
|
||||
$ANDROID_NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT $*
|
||||
pushd $ANDROID_NDK_ROOT
|
||||
./ndk-build -C $GAME_ANDROID_ROOT $*
|
||||
popd
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -9,14 +9,14 @@
|
|||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
WorkingDirectory="$(ProjectDir)Resource\"
|
||||
WorkingDirectory="$(ProjectDir)..\Resource\"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
WorkingDirectory="$(ProjectDir)Resource\"
|
||||
WorkingDirectory="$(ProjectDir)..\Resource\"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
@ -98,7 +98,7 @@
|
|||
* 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
|
||||
|
|
|
@ -1 +1 @@
|
|||
d501b155a2f81592835224d5cbd4f348438b5d9d
|
||||
b3c91670e8921218c2c6b169a95c5b9b5edae87c
|
|
@ -1 +1 @@
|
|||
1672304b77b25dcb9c0dfdf8abb8e7d0ffe02427
|
||||
9682d6c6192560740fbcc514f1700f431c02041d
|
|
@ -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
|
||||
|
|
|
@ -92,6 +92,10 @@ files
|
|||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
("../script_support")
|
||||
[script_support]
|
||||
"*.cpp"
|
||||
|
||||
("../sprite_nodes")
|
||||
[sprite_nodes]
|
||||
"*.cpp"
|
||||
|
|
|
@ -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"
|
|
@ -1 +1 @@
|
|||
d1962bc646d8650f27302fd6c32dff2d9d4ab6a5
|
||||
58728dc0be18955fcaabb9d6cd2ead3fdf389132
|
|
@ -1 +1 @@
|
|||
6c636339fa5aff82bfca50d9da220b50af5c0053
|
||||
f04508231e03751a17872c963c91f97e4335132a
|
|
@ -1 +1 @@
|
|||
0a09e265a353ec809a147d63541176ab261026fd
|
||||
62513e048519ce58a6a7b19d444f751b0e6ae9a4
|
Loading…
Reference in New Issue