| 72 | } |
| 73 | |
| 74 | void toggleSplashScreen(bool show) |
| 75 | { |
| 76 | // Attaches the current thread to the JVM. |
| 77 | jint lResult; |
| 78 | jint lFlags = 0; |
| 79 | |
| 80 | JavaVM* lJavaVM = platState.engine->app->activity->vm; |
| 81 | JNIEnv* lJNIEnv = platState.engine->app->activity->env; |
| 82 | |
| 83 | JavaVMAttachArgs lJavaVMAttachArgs; |
| 84 | lJavaVMAttachArgs.version = JNI_VERSION_1_6; |
| 85 | lJavaVMAttachArgs.name = "NativeThread"; |
| 86 | lJavaVMAttachArgs.group = NULL; |
| 87 | |
| 88 | lResult=lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs); |
| 89 | if (lResult == JNI_ERR) { |
| 90 | return; |
| 91 | } |
| 92 | |
| 93 | // Retrieves NativeActivity. |
| 94 | jobject lNativeActivity = platState.engine->app->activity->clazz; |
| 95 | jclass ClassNativeActivity = lJNIEnv->GetObjectClass(lNativeActivity); |
| 96 | |
| 97 | jmethodID getClassLoader = lJNIEnv->GetMethodID(ClassNativeActivity,"getClassLoader", "()Ljava/lang/ClassLoader;"); |
| 98 | jobject cls = lJNIEnv->CallObjectMethod(lNativeActivity, getClassLoader); |
| 99 | jclass classLoader = lJNIEnv->FindClass("java/lang/ClassLoader"); |
| 100 | jmethodID findClass = lJNIEnv->GetMethodID(classLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); |
| 101 | jstring strClassName = lJNIEnv->NewStringUTF("com.garagegames.torque2d.SplashScreen"); |
| 102 | jclass SplashScreenClass = (jclass)lJNIEnv->CallObjectMethod(cls, findClass, strClassName); |
| 103 | jmethodID MethodSplashScreen = lJNIEnv->GetStaticMethodID(SplashScreenClass, "ToggleSplashScreen", "(Landroid/content/Context;ZII)V"); |
| 104 | lJNIEnv->CallStaticVoidMethod(SplashScreenClass, MethodSplashScreen, lNativeActivity, (jboolean)show, (jint)platState.engine->width, (jint)platState.engine->height); |
| 105 | |
| 106 | // Finished with the JVM. |
| 107 | lJavaVM->DetachCurrentThread(); |
| 108 | } |
| 109 | |
| 110 | void ChangeVolume(bool up) { |
| 111 |
no outgoing calls
no test coverage detected