From b820a60e9831a296ffb9d8613ae8a591cb9b84ff Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 3 Sep 2017 23:36:55 +0200 Subject: [PATCH] Tweak default accelerometer sensitivity. Also move it to the config file. --- src/config/user_config.hpp | 5 +++++ src/input/input_manager.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index d59706ab3..bf059c058 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -435,6 +435,11 @@ namespace UserConfigParams &m_multitouch_group, "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", diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index e604e6b82..9057b888e 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -1191,15 +1191,18 @@ 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); } }