mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Pass in accelerometer readings using NativeAccelerometer instead of NativeAxis
This commit is contained in:
1 parent
3b004e7a4b
commit
c28dc9e4f2
6 files changed
+11
-38
No files matched your search
+6
-12
@@ -1336,22 +1336,12 @@ static void ProcessOneAxisEvent(const AxisInput &axis) {
|
||||
}
|
||||
|
||||
void NativeAxis(const AxisInput *axes, size_t count) {
|
||||
// figure out what the current tilt orientation is by checking the axis event
|
||||
// This is static, since we need to remember where we last were (in terms of orientation)
|
||||
static float tiltX;
|
||||
static float tiltY;
|
||||
static float tiltZ;
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
ProcessOneAxisEvent(axes[i]);
|
||||
switch (axes[i].axisId) {
|
||||
case JOYSTICK_AXIS_ACCELEROMETER_X: tiltX = axes[i].value; break;
|
||||
case JOYSTICK_AXIS_ACCELEROMETER_Y: tiltY = axes[i].value; break;
|
||||
case JOYSTICK_AXIS_ACCELEROMETER_Z: tiltZ = axes[i].value; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NativeAccelerometer(float tiltX, float tiltY, float tiltZ) {
|
||||
if (g_Config.iTiltInputType == TILT_NULL) {
|
||||
// if tilt events are disabled, don't do anything special.
|
||||
return;
|
||||
@@ -1377,6 +1367,10 @@ void NativeAxis(const AxisInput *axes, size_t count) {
|
||||
TiltEventProcessor::ProcessTilt(landscape, tiltBaseAngleY, tiltX, tiltY, tiltZ,
|
||||
g_Config.bInvertTiltX, g_Config.bInvertTiltY,
|
||||
xSensitivity, ySensitivity);
|
||||
|
||||
HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_ACCELEROMETER_X] = tiltX;
|
||||
HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_ACCELEROMETER_Y] = tiltY;
|
||||
HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_ACCELEROMETER_Z] = tiltZ;
|
||||
}
|
||||
|
||||
void System_PostUIMessage(const std::string &message, const std::string &value) {
|
||||
|
||||
Reference in new issue
Block a user