src/core/android/SDL_android.c
changeset 12152 cb129c06aa86
parent 12150 f958f3c2e006
child 12201 8bdc4d340419
child 12349 a67dedb293c8
equal deleted inserted replaced
12151:5b9895d82ebe 12152:cb129c06aa86
   256 
   256 
   257 /* method signatures */
   257 /* method signatures */
   258 static jmethodID midPollInputDevices;
   258 static jmethodID midPollInputDevices;
   259 static jmethodID midPollHapticDevices;
   259 static jmethodID midPollHapticDevices;
   260 static jmethodID midHapticRun;
   260 static jmethodID midHapticRun;
       
   261 static jmethodID midHapticStop;
   261 
   262 
   262 /* static fields */
   263 /* static fields */
   263 static jfieldID fidSeparateMouseAndTouch;
   264 static jfieldID fidSeparateMouseAndTouch;
   264 
   265 
   265 /* Accelerometer data storage */
   266 /* Accelerometer data storage */
   428                                 "pollInputDevices", "()V");
   429                                 "pollInputDevices", "()V");
   429     midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
   430     midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
   430                                 "pollHapticDevices", "()V");
   431                                 "pollHapticDevices", "()V");
   431     midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
   432     midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
   432                                 "hapticRun", "(II)V");
   433                                 "hapticRun", "(II)V");
   433 
   434     midHapticStop = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass,
   434     if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun) {
   435                                 "hapticStop", "(I)V");
       
   436 
       
   437     if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun || !midHapticStop) {
   435         __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?");
   438         __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?");
   436     }
   439     }
   437 
   440 
   438     checkJNIReady();
   441     checkJNIReady();
   439 }
   442 }
  1890 {
  1893 {
  1891     JNIEnv *env = Android_JNI_GetEnv();
  1894     JNIEnv *env = Android_JNI_GetEnv();
  1892     (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, length);
  1895     (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, length);
  1893 }
  1896 }
  1894 
  1897 
       
  1898 void Android_JNI_HapticStop(int device_id)
       
  1899 {
       
  1900     JNIEnv *env = Android_JNI_GetEnv();
       
  1901     (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticStop, device_id);
       
  1902 }
  1895 
  1903 
  1896 /* See SDLActivity.java for constants. */
  1904 /* See SDLActivity.java for constants. */
  1897 #define COMMAND_SET_KEEP_SCREEN_ON    5
  1905 #define COMMAND_SET_KEEP_SCREEN_ON    5
  1898 
  1906 
  1899 /* sends message to be handled on the UI event dispatch thread */
  1907 /* sends message to be handled on the UI event dispatch thread */