mirror of https://github.com/encounter/SDL.git
Added nativeGetHintBoolean for Java code
This commit is contained in:
parent
9ec2b35147
commit
be5b4d980d
|
@ -499,8 +499,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
// If we do, the normal hardware back button will no longer work and people have to use home,
|
// If we do, the normal hardware back button will no longer work and people have to use home,
|
||||||
// but the mouse right click will work.
|
// but the mouse right click will work.
|
||||||
//
|
//
|
||||||
String trapBack = SDLActivity.nativeGetHint("SDL_ANDROID_TRAP_BACK_BUTTON");
|
boolean trapBack = SDLActivity.nativeGetHintBoolean("SDL_ANDROID_TRAP_BACK_BUTTON", false);
|
||||||
if ((trapBack != null) && trapBack.equals("1")) {
|
if (trapBack) {
|
||||||
// Exit and let the mouse handler handle this button (if appropriate)
|
// Exit and let the mouse handler handle this button (if appropriate)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -803,6 +803,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
public static native void onNativeSurfaceChanged();
|
public static native void onNativeSurfaceChanged();
|
||||||
public static native void onNativeSurfaceDestroyed();
|
public static native void onNativeSurfaceDestroyed();
|
||||||
public static native String nativeGetHint(String name);
|
public static native String nativeGetHint(String name);
|
||||||
|
public static native boolean nativeGetHintBoolean(String name, boolean default_value);
|
||||||
public static native void nativeSetenv(String name, String value);
|
public static native void nativeSetenv(String name, String value);
|
||||||
public static native void onNativeOrientationChanged(int orientation);
|
public static native void onNativeOrientationChanged(int orientation);
|
||||||
public static native void nativeAddTouch(int touchId, String name);
|
public static native void nativeAddTouch(int touchId, String name);
|
||||||
|
|
|
@ -148,6 +148,10 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)(
|
||||||
JNIEnv *env, jclass cls,
|
JNIEnv *env, jclass cls,
|
||||||
jstring name);
|
jstring name);
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeGetHintBoolean)(
|
||||||
|
JNIEnv *env, jclass cls,
|
||||||
|
jstring name, jboolean default_value);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
||||||
JNIEnv *env, jclass cls,
|
JNIEnv *env, jclass cls,
|
||||||
jstring name, jstring value);
|
jstring name, jstring value);
|
||||||
|
@ -189,6 +193,7 @@ static JNINativeMethod SDLActivity_tab[] = {
|
||||||
{ "nativeResume", "()V", SDL_JAVA_INTERFACE(nativeResume) },
|
{ "nativeResume", "()V", SDL_JAVA_INTERFACE(nativeResume) },
|
||||||
{ "nativeFocusChanged", "(Z)V", SDL_JAVA_INTERFACE(nativeFocusChanged) },
|
{ "nativeFocusChanged", "(Z)V", SDL_JAVA_INTERFACE(nativeFocusChanged) },
|
||||||
{ "nativeGetHint", "(Ljava/lang/String;)Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetHint) },
|
{ "nativeGetHint", "(Ljava/lang/String;)Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetHint) },
|
||||||
|
{ "nativeGetHintBoolean", "(Ljava/lang/String;Z)Z", SDL_JAVA_INTERFACE(nativeGetHintBoolean) },
|
||||||
{ "nativeSetenv", "(Ljava/lang/String;Ljava/lang/String;)V", SDL_JAVA_INTERFACE(nativeSetenv) },
|
{ "nativeSetenv", "(Ljava/lang/String;Ljava/lang/String;)V", SDL_JAVA_INTERFACE(nativeSetenv) },
|
||||||
{ "onNativeOrientationChanged", "(I)V", SDL_JAVA_INTERFACE(onNativeOrientationChanged) },
|
{ "onNativeOrientationChanged", "(I)V", SDL_JAVA_INTERFACE(onNativeOrientationChanged) },
|
||||||
{ "nativeAddTouch", "(ILjava/lang/String;)V", SDL_JAVA_INTERFACE(nativeAddTouch) },
|
{ "nativeAddTouch", "(ILjava/lang/String;)V", SDL_JAVA_INTERFACE(nativeAddTouch) },
|
||||||
|
@ -1306,6 +1311,19 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeGetHintBoolean)(
|
||||||
|
JNIEnv *env, jclass cls,
|
||||||
|
jstring name, jboolean default_value)
|
||||||
|
{
|
||||||
|
jboolean result;
|
||||||
|
|
||||||
|
const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
|
||||||
|
result = SDL_GetHintBoolean(utfname, default_value);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, name, utfname);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
||||||
JNIEnv *env, jclass cls,
|
JNIEnv *env, jclass cls,
|
||||||
jstring name, jstring value)
|
jstring name, jstring value)
|
||||||
|
|
Loading…
Reference in New Issue