mirror of
https://github.com/godotengine/godot.git
synced 2025-10-27 11:44:21 +00:00
Support vibration for Android and iOS
This commit is contained in:
parent
86371b7298
commit
4061e5bb75
15 changed files with 68 additions and 0 deletions
|
|
@ -62,6 +62,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_godot_instance) {
|
|||
_init_input_devices = p_env->GetMethodID(cls, "initInputDevices", "()V");
|
||||
_get_surface = p_env->GetMethodID(cls, "getSurface", "()Landroid/view/Surface;");
|
||||
_is_activity_resumed = p_env->GetMethodID(cls, "isActivityResumed", "()Z");
|
||||
_vibrate = p_env->GetMethodID(cls, "vibrate", "(I)V");
|
||||
}
|
||||
|
||||
GodotJavaWrapper::~GodotJavaWrapper() {
|
||||
|
|
@ -211,3 +212,10 @@ bool GodotJavaWrapper::is_activity_resumed() {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void GodotJavaWrapper::vibrate(int p_duration_ms) {
|
||||
if (_vibrate) {
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
env->CallVoidMethod(godot_instance, _vibrate, p_duration_ms);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue