diff --git a/cocos/2d/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java b/cocos/2d/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java index 787f954280..eb1d5d0853 100644 --- a/cocos/2d/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java +++ b/cocos/2d/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java @@ -75,6 +75,7 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer { @Override public void onSurfaceChanged(final GL10 pGL10, final int pWidth, final int pHeight) { + Cocos2dxRenderer.nativeOnSurfaceChanged(pWidth, pHeight); } @Override @@ -118,6 +119,7 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer { private static native boolean nativeKeyDown(final int pKeyCode); private static native void nativeRender(); private static native void nativeInit(final int pWidth, final int pHeight); + private static native void nativeOnSurfaceChanged(final int pWidth, final int pHeight); private static native void nativeOnPause(); private static native void nativeOnResume(); diff --git a/cocos/2d/platform/android/javaactivity.cpp b/cocos/2d/platform/android/javaactivity.cpp index 9e068d1f63..52190a117a 100644 --- a/cocos/2d/platform/android/javaactivity.cpp +++ b/cocos/2d/platform/android/javaactivity.cpp @@ -79,4 +79,10 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi } +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged(JNIEnv* env, jobject thiz, jint w, jint h) +{ + cocos2d::Application::getInstance()->applicationScreenSizeChanged(w, h); +} + + }