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

@ -435,6 +435,11 @@ namespace UserConfigParams
&m_multitouch_group, &m_multitouch_group,
"A parameter in range [0, 0.5] that determines the zone that is " "A parameter in range [0, 0.5] that determines the zone that is "
"considered as max value in steering button.")); "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_PREFIX FloatUserConfigParam m_multitouch_scale
PARAM_DEFAULT( FloatUserConfigParam(1.1f, "multitouch_scale", PARAM_DEFAULT( FloatUserConfigParam(1.1f, "multitouch_scale",

View File

@ -1191,15 +1191,18 @@ EventPropagation InputManager::input(const SEvent& event)
if (button->type != BUTTON_STEERING) if (button->type != BUTTON_STEERING)
continue; continue;
float factor = UserConfigParams::m_multitouch_tilt_factor;
factor = std::max(factor, 0.1f);
if (UserConfigParams::m_multitouch_accelerometer == 1) 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); device->handleControls(button);
} }
else if (UserConfigParams::m_multitouch_accelerometer == 2) 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); device->handleControls(button);
} }
} }