mirror of
https://github.com/love2d/love-android.git
synced 2026-08-15 07:41:26 +02:00
fix the SDL accelerometer issue.
This commit is contained in:
@@ -497,10 +497,12 @@ 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);
|
||||
SDL_bool updated = Android_JNI_GetAccelerometerValues(values);
|
||||
if (updated) {
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
value = (Sint16)(values[i] * 32767.0f);
|
||||
SDL_PrivateJoystickAxis(item->joystick, i, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user