android: hide virtual joystick if no screen touch for 10 secs
This commit is contained in:
parent
eb73c2fcf1
commit
e11570e71b
|
@ -44,4 +44,5 @@ public final class JNIdc
|
|||
public static void show_osd() {
|
||||
JNIdc.vjoy(13, 1,0,0,0);
|
||||
}
|
||||
public static native void hideOsd();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.reicast.emulator.emu;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Handler;
|
||||
import android.os.Vibrator;
|
||||
import android.view.InputDevice;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -20,6 +21,14 @@ public class VirtualJoystickDelegate {
|
|||
private int selectedVjoyElement = -1;
|
||||
private ScaleGestureDetector scaleGestureDetector;
|
||||
|
||||
private Handler handler = new Handler();
|
||||
private Runnable hideOsdRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JNIdc.hideOsd();
|
||||
}
|
||||
};
|
||||
|
||||
private float[][] vjoy_d_custom;
|
||||
|
||||
private static final float[][] vjoy = VJoy.baseVJoy();
|
||||
|
@ -154,6 +163,8 @@ public class VirtualJoystickDelegate {
|
|||
// Ignore real mice, trackballs, etc.
|
||||
return false;
|
||||
JNIdc.show_osd();
|
||||
this.handler.removeCallbacks(hideOsdRunnable);
|
||||
this.handler.postDelayed(hideOsdRunnable, 10000);
|
||||
|
||||
scaleGestureDetector.onTouchEvent(event);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "hw/pvr/Renderer_if.h"
|
||||
#include "profiler/profiler.h"
|
||||
#include "rend/TexCache.h"
|
||||
#include "rend/gles/gles.h"
|
||||
#include "hw/maple/maple_devs.h"
|
||||
#include "hw/maple/maple_if.h"
|
||||
#include "hw/naomi/naomi_cart.h"
|
||||
|
@ -97,6 +98,7 @@ JNIEXPORT jboolean JNICALL Java_com_reicast_emulator_emu_JNIdc_rendframeJava(JNI
|
|||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_rendtermJava(JNIEnv *env, jobject obj) __attribute__((visibility("default")));
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_vjoy(JNIEnv * env, jobject obj,int id,float x, float y, float w, float h) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_hideOsd(JNIEnv * env, jobject obj) __attribute__((visibility("default")));
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_getControllers(JNIEnv *env, jobject obj, jintArray controllers, jobjectArray peripherals) __attribute__((visibility("default")));
|
||||
|
||||
|
@ -485,6 +487,10 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_vjoy(JNIEnv * env, jo
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_hideOsd(JNIEnv * env, jobject obj) {
|
||||
HideOSD();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_getControllers(JNIEnv *env, jobject obj, jintArray controllers, jobjectArray peripherals)
|
||||
{
|
||||
jint *controllers_body = env->GetIntArrayElements(controllers, 0);
|
||||
|
|
Loading…
Reference in New Issue