Input: add config entries for mouse deadzones and acceleration
This commit is contained in:
@@ -335,6 +335,11 @@ struct pad_config final : cfg::node
|
|||||||
cfg::_bool enable_vibration_motor_small{ this, "Enable Small Vibration Motor", true };
|
cfg::_bool enable_vibration_motor_small{ this, "Enable Small Vibration Motor", true };
|
||||||
cfg::_bool switch_vibration_motors{ this, "Switch Vibration Motors", false };
|
cfg::_bool switch_vibration_motors{ this, "Switch Vibration Motors", false };
|
||||||
|
|
||||||
|
cfg::_int<0, 255> mouse_deadzone_x{ this, "Mouse Deadzone X Axis", 60 };
|
||||||
|
cfg::_int<0, 255> mouse_deadzone_y{ this, "Mouse Deadzone Y Axis", 60 };
|
||||||
|
cfg::_int<0, 500> mouse_acceleration_x{ this, "Mouse Acceleration X Axis", 200 };
|
||||||
|
cfg::_int<0, 500> mouse_acceleration_y{ this, "Mouse Acceleration Y Axis", 250 };
|
||||||
|
|
||||||
bool load()
|
bool load()
|
||||||
{
|
{
|
||||||
if (fs::file cfg_file{ cfg_name, fs::read })
|
if (fs::file cfg_file{ cfg_name, fs::read })
|
||||||
|
|||||||
@@ -257,22 +257,22 @@ void keyboard_pad_handler::keyPressEvent(QKeyEvent* event)
|
|||||||
return;
|
return;
|
||||||
case Qt::Key_K:
|
case Qt::Key_K:
|
||||||
m_multi_y = std::min(m_multi_y + 0.1, 5.0);
|
m_multi_y = std::min(m_multi_y + 0.1, 5.0);
|
||||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %.2f", m_multi_y);
|
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", (int)(m_multi_y * 100));
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
case Qt::Key_J:
|
case Qt::Key_J:
|
||||||
m_multi_y = std::max(0.0, m_multi_y - 0.1);
|
m_multi_y = std::max(0.0, m_multi_y - 0.1);
|
||||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %.2f", m_multi_y);
|
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", (int)(m_multi_y * 100));
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
case Qt::Key_H:
|
case Qt::Key_H:
|
||||||
m_multi_x = std::min(m_multi_x + 0.1, 5.0);
|
m_multi_x = std::min(m_multi_x + 0.1, 5.0);
|
||||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %.2f", m_multi_x);
|
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", (int)(m_multi_x * 100));
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
case Qt::Key_G:
|
case Qt::Key_G:
|
||||||
m_multi_x = std::max(0.0, m_multi_x - 0.1);
|
m_multi_x = std::max(0.0, m_multi_x - 0.1);
|
||||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %.2f", m_multi_x);
|
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", (int)(m_multi_x * 100));
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@@ -513,6 +513,11 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
|
|||||||
if (p_profile == nullptr)
|
if (p_profile == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
m_deadzone_x = p_profile->mouse_deadzone_x;
|
||||||
|
m_deadzone_y = p_profile->mouse_deadzone_y;
|
||||||
|
m_multi_x = p_profile->mouse_acceleration_x / 100;
|
||||||
|
m_multi_y = p_profile->mouse_acceleration_y / 100;
|
||||||
|
|
||||||
auto find_key = [&](const cfg::string& name)
|
auto find_key = [&](const cfg::string& name)
|
||||||
{
|
{
|
||||||
int key = FindKeyCode(mouse_list, name, false);
|
int key = FindKeyCode(mouse_list, name, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user