mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion/simulator/android] Fix haptic feddback type return
This commit is contained in:
@@ -10,9 +10,12 @@ bool isEnabled() {
|
||||
JNIEnv * env = static_cast<JNIEnv *>(SDL_AndroidGetJNIEnv());
|
||||
jobject activity = static_cast<jobject>(SDL_AndroidGetActivity());
|
||||
jclass j_class = env->FindClass("com/numworks/calculator/EpsilonActivity");
|
||||
// TODO : GetMethodID is relatively costly, and could be performed only once.
|
||||
jmethodID j_methodId = env->GetMethodID(j_class,"hapticFeedbackIsEnabled", "()Z");
|
||||
|
||||
return env->CallObjectMethod(activity, j_methodId);
|
||||
if (j_methodId == 0) {
|
||||
return false;
|
||||
}
|
||||
return (env->CallBooleanMethod(activity, j_methodId) != JNI_FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void shutdown() {
|
||||
}
|
||||
|
||||
void rumble() {
|
||||
if (isEnabled() && sSDLHaptic) {
|
||||
if (sSDLHaptic && isEnabled()) {
|
||||
SDL_HapticRumblePlay(sSDLHaptic, 1.0, 40);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user