mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-27 12:21:21 -08:00
Added deadzone controls for sdl engine at input settings
This commit is contained in:
parent
ae0e481677
commit
4a566b9828
@ -236,6 +236,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
widget->setVisible(false);
|
widget->setVisible(false);
|
||||||
|
|
||||||
analog_map_stick = {ui->buttonLStickAnalog, ui->buttonRStickAnalog};
|
analog_map_stick = {ui->buttonLStickAnalog, ui->buttonRStickAnalog};
|
||||||
|
analog_map_deadzone = {ui->sliderLStickDeadzone, ui->sliderRStickDeadzone};
|
||||||
|
analog_map_deadzone_label = {ui->labelLStickDeadzone, ui->labelRStickDeadzone};
|
||||||
|
|
||||||
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
|
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
|
||||||
auto* const button = button_map[button_id];
|
auto* const button = button_map[button_id];
|
||||||
@ -326,6 +328,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||||||
InputCommon::Polling::DeviceType::Analog);
|
InputCommon::Polling::DeviceType::Analog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(analog_map_deadzone[analog_id], &QSlider::valueChanged, [=] {
|
||||||
|
const float deadzone = analog_map_deadzone[analog_id]->value() / 100.0f;
|
||||||
|
analog_map_deadzone_label[analog_id]->setText(tr("Deadzone: %1").arg(deadzone));
|
||||||
|
analogs_param[analog_id].Set("deadzone", deadzone);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
||||||
@ -484,7 +491,7 @@ void ConfigureInputPlayer::ClearAll() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
analogs_param[analog_id].Erase(analog_sub_buttons[sub_button_id]);
|
analogs_param[analog_id].Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,6 +515,23 @@ void ConfigureInputPlayer::UpdateButtonLabels() {
|
|||||||
AnalogToText(analogs_param[analog_id], analog_sub_buttons[sub_button_id]));
|
AnalogToText(analogs_param[analog_id], analog_sub_buttons[sub_button_id]));
|
||||||
}
|
}
|
||||||
analog_map_stick[analog_id]->setText(tr("Set Analog Stick"));
|
analog_map_stick[analog_id]->setText(tr("Set Analog Stick"));
|
||||||
|
|
||||||
|
auto& const param = analogs_param[analog_id];
|
||||||
|
auto* const analog_deadzone_slider = analog_map_deadzone[analog_id];
|
||||||
|
auto* const analog_deadzone_label = analog_map_deadzone_label[analog_id];
|
||||||
|
|
||||||
|
if (param.Has("engine") && param.Get("engine", "") == "sdl") {
|
||||||
|
if (!param.Has("deadzone")) {
|
||||||
|
param.Set("deadzone", 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
analog_deadzone_slider->setValue(static_cast<int>(param.Get("deadzone", 0.1f) * 100));
|
||||||
|
analog_deadzone_slider->setVisible(true);
|
||||||
|
analog_deadzone_label->setVisible(true);
|
||||||
|
} else {
|
||||||
|
analog_deadzone_slider->setVisible(false);
|
||||||
|
analog_deadzone_label->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +97,8 @@ private:
|
|||||||
/// Analog inputs are also represented each with a single button, used to configure with an
|
/// Analog inputs are also represented each with a single button, used to configure with an
|
||||||
/// actual analog stick
|
/// actual analog stick
|
||||||
std::array<QPushButton*, Settings::NativeAnalog::NumAnalogs> analog_map_stick;
|
std::array<QPushButton*, Settings::NativeAnalog::NumAnalogs> analog_map_stick;
|
||||||
|
std::array<QSlider*, Settings::NativeAnalog::NumAnalogs> analog_map_deadzone;
|
||||||
|
std::array<QLabel*, Settings::NativeAnalog::NumAnalogs> analog_map_deadzone_label;
|
||||||
|
|
||||||
static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
|
static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
|
||||||
|
|
||||||
|
@ -170,6 +170,44 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<layout class="QVBoxLayout" name="sliderRStickDeadzoneVerticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="sliderRStickDeadzoneHorizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelRStickDeadzone">
|
||||||
|
<property name="text">
|
||||||
|
<string>Deadzone: 0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<enum>Qt::AlignHCenter</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="sliderRStickDeadzone">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<spacer name="RStick_verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -745,6 +783,47 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="1" colspan="2">
|
||||||
|
<layout class="QVBoxLayout" name="sliderLStickDeadzoneVerticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="sliderLStickDeadzoneHorizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelLStickDeadzone">
|
||||||
|
<property name="text">
|
||||||
|
<string>Deadzone: 0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<enum>Qt::AlignHCenter</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="sliderLStickDeadzone">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<spacer name="LStick_verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user