mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
[Android] Fixes Bug 2370, don't send accelerometer changes when
Android_JNI_GetAccelerometerValues return SDL_FALSE (thanks to Jairo Luiz)
This commit is contained in:
parent
037475670f
commit
33479316c7
@ -497,10 +497,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
|||||||
while (item) {
|
while (item) {
|
||||||
if (item->is_accelerometer) {
|
if (item->is_accelerometer) {
|
||||||
if (item->joystick) {
|
if (item->joystick) {
|
||||||
Android_JNI_GetAccelerometerValues(values);
|
if (Android_JNI_GetAccelerometerValues(values)) {
|
||||||
for ( i = 0; i < 3; i++ ) {
|
for ( i = 0; i < 3; i++ ) {
|
||||||
value = (Sint16)(values[i] * 32767.0f);
|
value = (Sint16)(values[i] * 32767.0f);
|
||||||
SDL_PrivateJoystickAxis(item->joystick, i, value);
|
SDL_PrivateJoystickAxis(item->joystick, i, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user