mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[ion/simulator/android] Add assert, remove TODO
Change-Id: Id818d0cd9a83727171ebe675ee50e35ef64e31d0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "../../../shared/haptics.h"
|
||||
#include <jni.h>
|
||||
#include <SDL.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
@@ -10,11 +11,8 @@ 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");
|
||||
if (j_methodId == 0) {
|
||||
return false;
|
||||
}
|
||||
assert(j_methodId != 0);
|
||||
bool result = (env->CallBooleanMethod(activity, j_methodId) != JNI_FALSE);
|
||||
/* Local references are automatically deleted if a native function called from
|
||||
* Java side returns. For SDL this native function is main() itself. Therefore
|
||||
|
||||
Reference in New Issue
Block a user