Skip to content
Permalink
Browse files

Merge pull request #7755 from zackhow/score

Android: Update touch pointer from thread.
  • Loading branch information...
JosJuice committed Jan 31, 2019
2 parents 36cb7ba + 3cc10dc commit 9c38772301101c4cd0f2a7912c9314ce6492cb62
Showing with 18 additions and 5 deletions.
  1. +18 −5 Source/Android/jni/MainAndroid.cpp
@@ -72,6 +72,22 @@ Common::Event s_update_main_frame_event;
bool s_have_wm_user_stop = false;
} // Anonymous namespace

void UpdatePointer()
{
// Update touch pointer
JNIEnv* env;
int get_env_status =
IDCache::GetJavaVM()->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);

if (get_env_status == JNI_EDETACHED)
IDCache::GetJavaVM()->AttachCurrentThread(&env, nullptr);

env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetUpdateTouchPointer());

if (get_env_status == JNI_EDETACHED)
IDCache::GetJavaVM()->DetachCurrentThread();
}

void Host_NotifyMapLoaded()
{
}
@@ -108,11 +124,8 @@ void Host_UpdateMainFrame()

void Host_RequestRenderWindowSize(int width, int height)
{
// Update touch pointer
JNIEnv* env;
IDCache::GetJavaVM()->AttachCurrentThread(&env, nullptr);
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetUpdateTouchPointer());
IDCache::GetJavaVM()->DetachCurrentThread();
std::thread jnicall(UpdatePointer);
jnicall.join();
}

bool Host_UINeedsControllerState()

0 comments on commit 9c38772

Please sign in to comment.
You can’t perform that action at this time.