Support vibration magnitude on Android 8.0 (thanks Rachel!)

This commit is contained in:
Sam Lantinga
2018-10-16 08:29:27 -07:00
parent 7be4fca62c
commit b0c48dd9dd
4 changed files with 55 additions and 9 deletions

View File

@@ -235,7 +235,12 @@ int
SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
Uint32 iterations)
{
Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length);
float large = effect->effect.leftright.large_magnitude / 32767.0f;
float small = effect->effect.leftright.small_magnitude / 32767.0f;
float total = (large * 0.6f) + (small * 0.4f);
Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, total, effect->effect.leftright.length);
return 0;
}