mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 12:14:49 +02:00
implemented love.system.vibrate(seconds)
This commit is contained in:
@@ -91,6 +91,17 @@ bool openURL(const std::string &url)
|
||||
return true;
|
||||
}
|
||||
|
||||
void vibrate (double seconds)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameActivity");
|
||||
|
||||
jmethodID vibrate_method = env->GetStaticMethodID(activity, "vibrate", "(D)V");
|
||||
env->CallStaticVoidMethod(activity, vibrate_method, seconds);
|
||||
|
||||
env->DeleteLocalRef (activity);
|
||||
}
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ const char* getSelectedGameFile();
|
||||
|
||||
bool openURL (const std::string &url);
|
||||
|
||||
void vibrate (double seconds);
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user