mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3482 from minggo/release_unneeded_codes
Remove unneeded codes
This commit is contained in:
commit
faa94fd074
|
@ -7,21 +7,19 @@ LOCAL_MODULE := cocos2dxandroid_static
|
|||
LOCAL_MODULE_FILENAME := libcocos2dandroid
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CCDevice.cpp \
|
||||
CCEGLView.cpp \
|
||||
CCAccelerometer.cpp \
|
||||
CCApplication.cpp \
|
||||
CCCommon.cpp \
|
||||
CCDevice.cpp \
|
||||
CCEGLView.cpp \
|
||||
CCFileUtilsAndroid.cpp \
|
||||
CCImage.cpp \
|
||||
nativeactivity.cpp \
|
||||
jni/DPIJni.cpp \
|
||||
jni/IMEJni.cpp \
|
||||
jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \
|
||||
jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \
|
||||
jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \
|
||||
jni/JniHelper.cpp \
|
||||
jni/IMEJni.cpp \
|
||||
jni/TouchesJni.cpp \
|
||||
jni/DPIJni.cpp
|
||||
jni/JniHelper.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package org.cocos2dx.lib;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.opengl.ETC1Util;
|
||||
import android.util.Log;
|
||||
|
||||
public class Cocos2dxETCLoader {
|
||||
private static final String ASSETS_PATH = "assets/";
|
||||
private static Context context;
|
||||
|
||||
public static boolean loadTexture(String filePath) {
|
||||
if (! ETC1Util.isETC1Supported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filePath.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create ETC1Texture
|
||||
InputStream inputStream = null;
|
||||
ETC1Util.ETC1Texture texture = null;
|
||||
AssetManager assetManager = null;
|
||||
try {
|
||||
if (filePath.charAt(0) == '/') {
|
||||
// absolute path
|
||||
inputStream = new FileInputStream(filePath);
|
||||
} else {
|
||||
// remove prefix: "assets/"
|
||||
if (filePath.startsWith(ASSETS_PATH)) {
|
||||
filePath = filePath.substring(ASSETS_PATH.length());
|
||||
}
|
||||
assetManager = context.getAssets();
|
||||
inputStream = assetManager.open(filePath);
|
||||
}
|
||||
|
||||
texture = ETC1Util.createTexture(inputStream);
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
Log.d("Cocos2dx", "Unable to create texture for " + filePath);
|
||||
|
||||
texture = null;
|
||||
}
|
||||
|
||||
if (texture != null) {
|
||||
boolean ret = true;
|
||||
|
||||
try {
|
||||
final int width = texture.getWidth();
|
||||
final int height = texture.getHeight();
|
||||
final int length = texture.getData().remaining();
|
||||
|
||||
final byte[] data = new byte[length];
|
||||
final ByteBuffer buf = ByteBuffer.wrap(data);
|
||||
buf.order(ByteOrder.nativeOrder());
|
||||
buf.put(texture.getData());
|
||||
|
||||
nativeSetTextureInfo(width,
|
||||
height,
|
||||
data,
|
||||
length);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Log.d("invoke native function error", e.toString());
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setContext(Context context) {
|
||||
Cocos2dxETCLoader.context = context;
|
||||
}
|
||||
|
||||
private static native void nativeSetTextureInfo(final int width, final int height, final byte[] data,
|
||||
final int dataLength);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#include "cocoa/CCGeometry.h"
|
||||
#include "platform/android/CCAccelerometer.h"
|
||||
#include "../CCEGLView.h"
|
||||
#include "JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include "CCDirector.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxAccelerometer_onSensorChanged(JNIEnv* env, jobject thiz, jfloat x, jfloat y, jfloat z, jlong timeStamp) {
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "cocoa/CCSet.h"
|
||||
#include "CCDirector.h"
|
||||
#include "keypad_dispatcher/CCKeypadDispatcher.h"
|
||||
#include "touch_dispatcher/CCTouch.h"
|
||||
#include "../CCEGLView.h"
|
||||
#include "touch_dispatcher/CCTouchDispatcher.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
|
||||
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
|
||||
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
|
||||
int size = env->GetArrayLength(ids);
|
||||
jint id[size];
|
||||
jfloat x[size];
|
||||
jfloat y[size];
|
||||
|
||||
env->GetIntArrayRegion(ids, 0, size, id);
|
||||
env->GetFloatArrayRegion(xs, 0, size, x);
|
||||
env->GetFloatArrayRegion(ys, 0, size, y);
|
||||
|
||||
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, id, x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
|
||||
int size = env->GetArrayLength(ids);
|
||||
jint id[size];
|
||||
jfloat x[size];
|
||||
jfloat y[size];
|
||||
|
||||
env->GetIntArrayRegion(ids, 0, size, id);
|
||||
env->GetFloatArrayRegion(xs, 0, size, x);
|
||||
env->GetFloatArrayRegion(ys, 0, size, y);
|
||||
|
||||
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, id, x, y);
|
||||
}
|
||||
|
||||
#define KEYCODE_BACK 0x04
|
||||
#define KEYCODE_MENU 0x52
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown(JNIEnv * env, jobject thiz, jint keyCode) {
|
||||
Director* pDirector = Director::getInstance();
|
||||
switch (keyCode) {
|
||||
case KEYCODE_BACK:
|
||||
if (pDirector->getKeypadDispatcher()->dispatchKeypadMSG(kTypeBackClicked))
|
||||
return JNI_TRUE;
|
||||
break;
|
||||
case KEYCODE_MENU:
|
||||
if (pDirector->getKeypadDispatcher()->dispatchKeypadMSG(kTypeMenuClicked))
|
||||
return JNI_TRUE;
|
||||
break;
|
||||
default:
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
|
||||
APP_ABI := armeabi
|
||||
APP_OPTIM := debug
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
|
||||
APP_OPTIM := debug
|
||||
APP_ABI := armeabi
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT= -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix
|
||||
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
|
||||
|
|
|
@ -21,4 +21,8 @@
|
|||
'mkfile' : 'external/chipmunk/Android.mk',
|
||||
'pathes' : ("external/chipmunk/",),
|
||||
},
|
||||
{
|
||||
'mkfile' : 'cocos2dx/platform/android/Android.mk',
|
||||
'pathes' : ('cocos2dx/platform/android/',),
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue