jobject Java_com_oculus_vrappframework_VrActivity_nativeGetPopupSurfaceTexture( JNIEnv *jni, jclass clazz, jlong appPtr ) { OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; LOG( "%p getPopUpSurfaceTexture: %i", (void *)appPtr, appLocal->GetDialogTexture()->GetTextureId() ); return appLocal->GetDialogTexture()->GetJavaObject(); }
void Java_com_oculus_vrappframework_VrApp_nativeOnResume( JNIEnv *jni, jclass clazz, jlong appPtr ) { LOG( "%p nativeResume", (void *)appPtr ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; appLocal->GetMessageQueue().SendPrintf( "resume " ); }
void Java_com_oculus_vrappframework_VrActivity_nativePopup( JNIEnv *jni, jclass clazz, jlong appPtr, jint width, jint height, jfloat seconds ) { LOG( "%p nativePopup", (void *)appPtr ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; appLocal->GetMessageQueue().PostPrintf( "popup %i %i %f", width, height, seconds ); }
void Java_com_oculus_vrappframework_VrActivity_nativeTouch( JNIEnv *jni, jclass clazz, jlong appPtr, jint action, jfloat x, jfloat y ) { OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; // Suspend input until EnteredVrMode( INTENT_LAUNCH ) has finished to avoid overflowing the message queue on long loads. if ( appLocal->IntentType != OVR::INTENT_LAUNCH ) { appLocal->GetMessageQueue().PostPrintfIfSpaceAvailable( MIN_SLOTS_AVAILABLE_FOR_INPUT, "touch %i %f %f", action, x, y ); } }
void Java_com_oculus_vrappframework_VrActivity_nativeJoypadAxis( JNIEnv *jni, jclass clazz, jlong appPtr, jfloat lx, jfloat ly, jfloat rx, jfloat ry ) { OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; // Suspend input until OneTimeInit() has finished to avoid overflowing the message queue on long loads. if ( appLocal->OneTimeInitCalled ) { appLocal->GetMessageQueue().PostPrintfIfSpaceAvailable( MIN_SLOTS_AVAILABLE_FOR_INPUT, "joy %f %f %f %f", lx, ly, rx, ry ); } }
void Java_com_oculus_vrappframework_VrActivity_nativeKeyEvent( JNIEnv *jni, jclass clazz, jlong appPtr, jint key, jboolean down, jint repeatCount ) { OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; // Suspend input until OneTimeInit() has finished to avoid overflowing the message queue on long loads. if ( appLocal->OneTimeInitCalled ) { OVR::ovrKeyCode keyCode = OVR::OSKeyToKeyCode( key ); appLocal->GetMessageQueue().PostPrintfIfSpaceAvailable( MIN_SLOTS_AVAILABLE_FOR_INPUT, "key %i %i %i", keyCode, down, repeatCount ); } }
void Java_com_oculus_vrappframework_VrActivity_nativeKeyEvent( JNIEnv *jni, jclass clazz, jlong appPtr, jint key, jboolean down, jint repeatCount ) { OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; // Suspend input until EnteredVrMode( INTENT_LAUNCH ) has finished to avoid overflowing the message queue on long loads. if ( appLocal->IntentType != OVR::INTENT_LAUNCH ) { OVR::ovrKeyCode keyCode = OVR::OSKeyToKeyCode( key ); //LOG( "nativeKeyEvent: key = %i, keyCode = %i, down = %s, repeatCount = %i", key, keyCode, down ? "true" : "false", repeatCount ); appLocal->GetMessageQueue().PostPrintfIfSpaceAvailable( MIN_SLOTS_AVAILABLE_FOR_INPUT, "key %i %i %i", keyCode, down, repeatCount ); } }
void Java_com_oculus_vrappframework_VrApp_nativeSurfaceDestroyed( JNIEnv *jni, jclass clazz, jlong appPtr, jobject surface ) { LOG( "%p nativeSurfaceDestroyed()", (void *)appPtr ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; appLocal->GetMessageQueue().SendPrintf( "surfaceDestroyed " ); LOG( " ANativeWindow_release( %p )", appLocal->pendingNativeWindow ); ANativeWindow_release( appLocal->pendingNativeWindow ); appLocal->pendingNativeWindow = NULL; }
void Java_com_oculus_vrappframework_VrActivity_nativeNewIntent( JNIEnv *jni, jclass clazz, jlong appPtr, jstring fromPackageName, jstring command, jstring uriString ) { LOG( "%p nativeNewIntent", (void *)appPtr ); JavaUTFChars utfPackageName( jni, fromPackageName ); JavaUTFChars utfUri( jni, uriString ); JavaUTFChars utfJson( jni, command ); char intentMessage[4096]; ComposeIntentMessage( utfPackageName.ToStr(), utfUri.ToStr(), utfJson.ToStr(), intentMessage, sizeof( intentMessage ) ); LOG( "nativeNewIntent: %s", intentMessage ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; appLocal->GetMessageQueue().PostString( intentMessage ); }
void Java_com_oculus_vrappframework_VrApp_nativeSurfaceCreated( JNIEnv *jni, jclass clazz, jlong appPtr, jobject surface ) { LOG( "%p nativeSurfaceCreated( %p )", (void *)appPtr, surface ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; ANativeWindow * newNativeWindow = ANativeWindow_fromSurface( jni, surface ); if ( ANativeWindow_getWidth( newNativeWindow ) < ANativeWindow_getHeight( newNativeWindow ) ) { // An app that is relaunched after pressing the home button gets an initial surface with // the wrong orientation even though android:screenOrientation="landscape" is set in the // manifest. The choreographer callback will also never be called for this surface because // the surface is immediately replaced with a new surface with the correct orientation. WARN( " Surface not in landscape mode!" ); } LOG( " pendingNativeWindow = ANativeWindow_fromSurface( jni, surface )" ); appLocal->pendingNativeWindow = newNativeWindow; appLocal->GetMessageQueue().SendPrintf( "surfaceCreated " ); }
void Java_com_oculus_vrappframework_VrApp_nativeOnDestroy( JNIEnv *jni, jclass clazz, jlong appPtr ) { LOG( "%p nativeDestroy", (void *)appPtr ); OVR::AppLocal * appLocal = (OVR::AppLocal *)appPtr; const bool exitOnDestroy = appLocal->ExitOnDestroy; appLocal->StopVrThread(); appLocal->SetActivity( jni, NULL ); delete appLocal; vrapi_Shutdown(); if ( exitOnDestroy ) { LOG( "ExitOnDestroy is true, exiting" ); exit( 0 ); // FIXME: is this still needed? } else { LOG( "ExitOnDestroy was false, returning normally." ); } }