diff --git a/samples/Cpp/TestCpp/proj.android/AndroidManifest.xml b/samples/Cpp/TestCpp/proj.android/AndroidManifest.xml index 3ca0ab76c5..7fb131c54c 100644 --- a/samples/Cpp/TestCpp/proj.android/AndroidManifest.xml +++ b/samples/Cpp/TestCpp/proj.android/AndroidManifest.xml @@ -10,11 +10,16 @@ - + android:configChanges="orientation|screenSize|smallestScreenSize"> + + + + diff --git a/samples/Cpp/TestCpp/proj.android/jni/Android.mk b/samples/Cpp/TestCpp/proj.android/jni/Android.mk index 729cafc750..210fef8fa1 100644 --- a/samples/Cpp/TestCpp/proj.android/jni/Android.mk +++ b/samples/Cpp/TestCpp/proj.android/jni/Android.mk @@ -16,6 +16,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static +LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static include $(BUILD_SHARED_LIBRARY) @@ -26,3 +27,4 @@ $(call import-module,CocosDenshion/android) $(call import-module,extensions) $(call import-module,external/Box2D) $(call import-module,external/chipmunk) +$(call import-module,cocos2dx/platform/android) diff --git a/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp b/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp index 6833c086ca..ca56f8d7ff 100644 --- a/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp +++ b/samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp @@ -10,35 +10,7 @@ using namespace cocos2d; -extern "C" -{ - -jint JNI_OnLoad(JavaVM *vm, void *reserved) -{ - JniHelper::setJavaVM(vm); - - return JNI_VERSION_1_4; -} - -void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) -{ - if (!Director::getInstance()->getOpenGLView()) - { - EGLView *view = EGLView::getInstance(); - view->setFrameSize(w, h); - - AppDelegate *pAppDelegate = new AppDelegate(); - Application::getInstance()->run(); - } - else - { - GL::invalidateStateCache(); - ShaderCache::getInstance()->reloadDefaultShaders(); - DrawPrimitives::init(); - TextureCache::reloadAllTextures(); - NotificationCenter::getInstance()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); - Director::getInstance()->setGLDefaultValues(); - } -} - +void cocos_android_app_init (void) { + LOGD("cocos_android_app_init"); + AppDelegate *pAppDelegate = new AppDelegate(); } diff --git a/samples/Cpp/TestCpp/proj.android/src/nojava.txt b/samples/Cpp/TestCpp/proj.android/src/nojava.txt new file mode 100644 index 0000000000..b8ad10a43d --- /dev/null +++ b/samples/Cpp/TestCpp/proj.android/src/nojava.txt @@ -0,0 +1 @@ +No Java files diff --git a/samples/Cpp/TestCpp/proj.android/src/org/cocos2dx/testcpp/TestCpp.java b/samples/Cpp/TestCpp/proj.android/src/org/cocos2dx/testcpp/TestCpp.java deleted file mode 100644 index 282643a6de..0000000000 --- a/samples/Cpp/TestCpp/proj.android/src/org/cocos2dx/testcpp/TestCpp.java +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2011 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.testcpp; - -import org.cocos2dx.lib.Cocos2dxActivity; -import org.cocos2dx.lib.Cocos2dxGLSurfaceView; - -import android.os.Bundle; - -public class TestCpp extends Cocos2dxActivity{ - - protected void onCreate(Bundle savedInstanceState){ - super.onCreate(savedInstanceState); - } - - public Cocos2dxGLSurfaceView onCreateView() { - Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); - // TestCpp should create stencil buffer - glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); - - return glSurfaceView; - } - - static { - System.loadLibrary("testcpp"); - } -}