Skip to content

Commit

Permalink
[Android] Fixes Bug 2370, don't send accelerometer changes when
Browse files Browse the repository at this point in the history
Android_JNI_GetAccelerometerValues return SDL_FALSE (thanks to Jairo Luiz)
  • Loading branch information
gabomdq committed Jan 27, 2014
1 parent 0374756 commit 3347931
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/joystick/android/SDL_sysjoystick.c
Expand Up @@ -497,10 +497,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
while (item) {
if (item->is_accelerometer) {
if (item->joystick) {
Android_JNI_GetAccelerometerValues(values);
for ( i = 0; i < 3; i++ ) {
value = (Sint16)(values[i] * 32767.0f);
SDL_PrivateJoystickAxis(item->joystick, i, value);
if (Android_JNI_GetAccelerometerValues(values)) {
for ( i = 0; i < 3; i++ ) {
value = (Sint16)(values[i] * 32767.0f);
SDL_PrivateJoystickAxis(item->joystick, i, value);
}
}
}
break;
Expand Down

0 comments on commit 3347931

Please sign in to comment.