shellspace icon indicating copy to clipboard operation
shellspace copied to clipboard

Bluetooth mouse support

Open wadetb opened this issue 10 years ago • 0 comments

Using the Android Motion events:

http://developer.android.com/reference/android/view/MotionEvent.html

Have to plumb this through from the Java code:

// VRLib/src/com/oculusvr/vrlib/VrActivity.java:
public static native void nativeKeyEvent(long appPtr, int keyNum, boolean down, int repeatCount );

// VRLib/jni/App.cpp
void Java_com_oculusvr_vrlib_VrActivity_nativeKeyEvent( JNIEnv *jni, jclass clazz,
        jlong appPtr, jint key, jboolean down, jint repeatCount )
{
    AppLocal * local = ((AppLocal *)appPtr);
    // Suspend input until OneTimeInit() has finished to avoid overflowing the message queue on long loads.
    if ( local->OneTimeInitCalled )
    {
        local->GetMessageQueue().PostPrintf( "key %i %i %i", key, down, repeatCount );
    }
}

if ( MatchesHead( "key ", msg ) )
{
    int key, down, repeatCount;
    sscanf( msg, "key %i %i %i", &key, &down, &repeatCount );
    KeyEvent( key, down, repeatCount );
    return; 
}

wadetb avatar Jun 14 '15 01:06 wadetb