From 4aa863896e656325e707e20cfe29c6401f9576d6 Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 10 May 2019 20:41:00 -0700 Subject: Fixed android build; moved NDKHelper from Core module to NativeAppCommon --- Common/NativeApp/src/Android/AndroidAppBase.cpp | 9 +++++---- Common/NativeApp/src/Android/AndroidMain.cpp | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'Common/NativeApp/src/Android') diff --git a/Common/NativeApp/src/Android/AndroidAppBase.cpp b/Common/NativeApp/src/Android/AndroidAppBase.cpp index 4a1a4e2..f3e341c 100644 --- a/Common/NativeApp/src/Android/AndroidAppBase.cpp +++ b/Common/NativeApp/src/Android/AndroidAppBase.cpp @@ -37,7 +37,7 @@ int AndroidAppBase::InitDisplay() { if( !initialized_resources_ ) { - Initialize(app_->window); + Initialize(); LoadResources(); initialized_resources_ = true; @@ -51,7 +51,7 @@ int AndroidAppBase::InitDisplay() LoadResources(); } } - + ShowUI(); //tap_camera_.SetFlip( 1.f, -1.f, -1.f ); @@ -89,7 +89,7 @@ void AndroidAppBase::DrawFrame() auto CurrTime = Timer.GetElapsedTime(); auto ElapsedTime = CurrTime - PrevTime; PrevTime = CurrTime; - + Update(CurrTime, ElapsedTime); Render(); @@ -211,9 +211,10 @@ void AndroidAppBase::SuspendSensors() //------------------------------------------------------------------------- //Misc //------------------------------------------------------------------------- -void AndroidAppBase::SetState( android_app* state ) +void AndroidAppBase::SetState( android_app* state, const char* native_activity_class_name ) { app_ = state; + native_activity_class_name_ = native_activity_class_name; doubletap_detector_.SetConfiguration( app_->config ); drag_detector_.SetConfiguration( app_->config ); pinch_detector_.SetConfiguration( app_->config ); diff --git a/Common/NativeApp/src/Android/AndroidMain.cpp b/Common/NativeApp/src/Android/AndroidMain.cpp index 27fd90c..6e65b8a 100644 --- a/Common/NativeApp/src/Android/AndroidMain.cpp +++ b/Common/NativeApp/src/Android/AndroidMain.cpp @@ -30,6 +30,7 @@ #define HELPER_CLASS_NAME "com/android/helper/NDKHelper" //Class name of helper function +#define NATIVEACTIVITY_CLASS_NAME "android/app/NativeActivity" using namespace Diligent; @@ -38,11 +39,8 @@ using namespace Diligent; // event loop for receiving input events and doing other things. void android_main( android_app* state ) { - // Despite the deprecation warning, removing call to app_dummy causes the app to crash! - app_dummy(); - std::unique_ptr theApp(CreateApplication()); - theApp->SetState( state ); + theApp->SetState( state, NATIVEACTIVITY_CLASS_NAME ); //Init helper functions ndk_helper::JNIHelper::Init( state->activity, HELPER_CLASS_NAME ); -- cgit v1.2.3