src/joystick/android/SDL_sysjoystick.c
changeset 6212 78d854de3a66
parent 6138 4c64952a58fb
child 6695 ec21e81c62aa
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Thu Jan 12 22:54:09 2012 -0500
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Fri Jan 13 20:57:35 2012 -0500
     1.3 @@ -86,12 +86,14 @@
     1.4  SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
     1.5  {
     1.6      int i;
     1.7 +    Sint16 value;
     1.8      float values[3];
     1.9  
    1.10 -    Android_JNI_GetAccelerometerValues(values);
    1.11 -
    1.12 -    for ( i = 0; i < 3; i++ ) {
    1.13 -        SDL_PrivateJoystickAxis(joystick, i, values[i]);
    1.14 +    if (Android_JNI_GetAccelerometerValues(values)) {
    1.15 +        for ( i = 0; i < 3; i++ ) {
    1.16 +            value = (Sint16)(values[i] * 32767.0f);
    1.17 +            SDL_PrivateJoystickAxis(joystick, i, value);
    1.18 +        }
    1.19      }
    1.20  }
    1.21