Tweak default accelerometer sensitivity.

Also move it to the config file.
This commit is contained in:
Deve 2017-09-03 23:36:55 +02:00
parent 590ec78640
commit b820a60e98
2 changed files with 10 additions and 2 deletions

View File

@ -436,6 +436,11 @@ namespace UserConfigParams
"A parameter in range [0, 0.5] that determines the zone that is "
"considered as max value in steering button."));
PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor
PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor",
&m_multitouch_group,
"A parameter that determines general accelerometer sensitivity."));
PARAM_PREFIX FloatUserConfigParam m_multitouch_scale
PARAM_DEFAULT( FloatUserConfigParam(1.1f, "multitouch_scale",
&m_multitouch_group,

View File

@ -1192,14 +1192,17 @@ EventPropagation InputManager::input(const SEvent& event)
if (button->type != BUTTON_STEERING)
continue;
float factor = UserConfigParams::m_multitouch_tilt_factor;
factor = std::max(factor, 0.1f);
if (UserConfigParams::m_multitouch_accelerometer == 1)
{
button->axis_x = (float)-event.AccelerometerEvent.X / 5.0f;
button->axis_x = (float)-event.AccelerometerEvent.X / factor;
device->handleControls(button);
}
else if (UserConfigParams::m_multitouch_accelerometer == 2)
{
button->axis_x = (float)event.AccelerometerEvent.Y / 5.0f;
button->axis_x = (float)event.AccelerometerEvent.Y / factor;
device->handleControls(button);
}
}