1
0
Fork 0
forked from suyu/suyu

undo unnecessary newlines, slider range 50-150

This commit is contained in:
Ameer 2020-07-15 00:44:08 -04:00 committed by ameerj
parent 504095cea9
commit 8928aa3008
3 changed files with 5 additions and 6 deletions

View file

@ -461,7 +461,7 @@ public:
const int axis_x = params.Get("axis_x", 0); const int axis_x = params.Get("axis_x", 0);
const int axis_y = params.Get("axis_y", 1); const int axis_y = params.Get("axis_y", 1);
const float deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, .99f); const float deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, .99f);
const float range = std::clamp(params.Get("range", 0.0f), 0.0f, .99f) + 0.50f; const float range = std::clamp(params.Get("range", 0.0f), 0.50f, 1.50f);
auto joystick = state.GetSDLJoystickByGUID(guid, port); auto joystick = state.GetSDLJoystickByGUID(guid, port);
// This is necessary so accessing GetAxis with axis_x and axis_y won't crash // This is necessary so accessing GetAxis with axis_x and axis_y won't crash

View file

@ -272,6 +272,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
ui->sliderRStickDeadzoneAndModifier}; ui->sliderRStickDeadzoneAndModifier};
analog_map_deadzone_and_modifier_slider_label = {ui->labelLStickDeadzoneAndModifier, analog_map_deadzone_and_modifier_slider_label = {ui->labelLStickDeadzoneAndModifier,
ui->labelRStickDeadzoneAndModifier}; ui->labelRStickDeadzoneAndModifier};
ui->sliderLStickRange->setRange(50, 150);
ui->sliderRStickRange->setRange(50, 150);
analog_map_range_slider = {ui->sliderLStickRange, ui->sliderRStickRange}; analog_map_range_slider = {ui->sliderLStickRange, ui->sliderRStickRange};
analog_map_range_slider_label = {ui->labelLStickRange, ui->labelRStickRange}; analog_map_range_slider_label = {ui->labelLStickRange, ui->labelRStickRange};
@ -386,7 +388,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
const auto engine = analogs_param[analog_id].Get("engine", ""); const auto engine = analogs_param[analog_id].Get("engine", "");
if (engine == "sdl" || engine == "gcpad") { if (engine == "sdl" || engine == "gcpad") {
analog_map_range_slider_label[analog_id]->setText( analog_map_range_slider_label[analog_id]->setText(
tr("Range: %1%").arg(slider_value + 50.0f)); tr("Range: %1%").arg(slider_value));
analogs_param[analog_id].Set("range", slider_value / 100.0f); analogs_param[analog_id].Set("range", slider_value / 100.0f);
} }
}); });
@ -613,7 +615,7 @@ void ConfigureInputPlayer::UpdateButtonLabels() {
} }
// QtSlider returns values from 0.0-0.99. We want range to be from 50% to 150% // QtSlider returns values from 0.0-0.99. We want range to be from 50% to 150%
analog_stick_range->setValue(static_cast<int>(param.Get("range", 0.1f) * 100)); analog_stick_range->setValue(static_cast<int>(param.Get("range", 0.1f) * 100));
if (analog_stick_range->value() == 0) { if (analog_stick_range->value() == 50) {
analog_stick_range_label->setText(tr("Range: 50%")); analog_stick_range_label->setText(tr("Range: 50%"));
} }
} else { } else {

View file

@ -222,7 +222,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<spacer name="RStick_verticalSpacer"> <spacer name="RStick_verticalSpacer">
@ -840,7 +839,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="6" column="1" colspan="2"> <item row="6" column="1" colspan="2">
<layout class="QVBoxLayout" name="sliderLStickRangeVerticalLayout"> <layout class="QVBoxLayout" name="sliderLStickRangeVerticalLayout">
<property name="sizeConstraint"> <property name="sizeConstraint">
@ -868,7 +866,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
<spacer name="LStick_verticalSpacer"> <spacer name="LStick_verticalSpacer">