Fixed accelerometer reverting X and Y coordinates
This commit is contained in:
@@ -392,7 +392,7 @@ void updateOrientation ( float accX, float accY, float accZ )
|
||||
if( SDL_ANDROID_isJoystickUsed && SDL_ANDROID_CurrentJoysticks[0] ) // TODO: mutex for that stuff?
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "updateOrientation(): sending joystick event");
|
||||
SDL_PrivateJoystickAxis(SDL_ANDROID_CurrentJoysticks[0], 0, (Sint16)(fminf(32767.0f, fmax(-32767.0f, (accX - midX) * joystickSensitivity))));
|
||||
SDL_PrivateJoystickAxis(SDL_ANDROID_CurrentJoysticks[0], 0, (Sint16)(fminf(32767.0f, fmax(-32767.0f, -(accX - midX) * joystickSensitivity))));
|
||||
SDL_PrivateJoystickAxis(SDL_ANDROID_CurrentJoysticks[0], 1, (Sint16)(fminf(32767.0f, fmax(-32767.0f, (accY - midY) * joystickSensitivity))));
|
||||
SDL_PrivateJoystickAxis(SDL_ANDROID_CurrentJoysticks[0], 2, (Sint16)(fminf(32767.0f, fmax(-32767.0f, (accZ - midZ) * joystickSensitivity))));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
|
||||
package org.enigmagame.enigma;
|
||||
package de.schwardtnet.alienblaster;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -48,10 +48,7 @@ class AccelerometerReader implements SensorEventListener {
|
||||
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
|
||||
{
|
||||
if( Globals.HorizontalOrientation )
|
||||
// TODO: it feels better for me to use tilt as X value instead of intuitive horizontal phone orientation
|
||||
// because then I can hold device comfortably, we need another user-configurable option for that
|
||||
// nativeOrientation(event.values[1], -event.values[2], event.values[0]); // Comfortable setting
|
||||
nativeAccelerometer(-event.values[1], -event.values[0], event.values[2]); // Intuitive setting
|
||||
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]);
|
||||
else
|
||||
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); // TODO: not tested!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user