stick sensitivity (#3725)

This commit is contained in:
briaguya 2023-12-23 18:48:06 -05:00 committed by GitHub
parent 0a59ce6d99
commit 776c3a51ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 1 deletions

@ -1 +1 @@
Subproject commit d25e0e977755ec09c22d6540963ffcd825954a23
Subproject commit 15d57d806e39d7f19783e26acc1a062d402169c7

View File

@ -636,6 +636,45 @@ void SohInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, int32_t
ImGui::EndGroup();
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode(StringHelper::Sprintf("Analog Stick Options##%d", id).c_str())) {
ImGui::Text("Sensitivity:");
int32_t sensitivityPercentage = controllerStick->GetSensitivityPercentage();
if (sensitivityPercentage == 0) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("-##Sensitivity%d", id).c_str())) {
controllerStick->SetSensitivity(sensitivityPercentage - 1);
}
ImGui::PopButtonRepeat();
if (sensitivityPercentage == 0) {
ImGui::EndDisabled();
}
ImGui::SameLine(0.0f, 0.0f);
ImGui::SetNextItemWidth(SCALE_IMGUI_SIZE(160.0f));
if (ImGui::SliderInt(StringHelper::Sprintf("##Sensitivity%d", id).c_str(), &sensitivityPercentage, 0, 200, "%d%%",
ImGuiSliderFlags_AlwaysClamp)) {
controllerStick->SetSensitivity(sensitivityPercentage);
}
ImGui::SameLine(0.0f, 0.0f);
if (sensitivityPercentage == 200) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("+##Sensitivity%d", id).c_str())) {
controllerStick->SetSensitivity(sensitivityPercentage + 1);
}
ImGui::PopButtonRepeat();
if (sensitivityPercentage == 200) {
ImGui::EndDisabled();
}
if (!controllerStick->SensitivityIsDefault()) {
ImGui::SameLine();
if (ImGui::Button(StringHelper::Sprintf("Reset to Default###resetStickSensitivity%d", id).c_str())) {
controllerStick->ResetSensitivityToDefault();
}
}
ImGui::Text("Deadzone:");
int32_t deadzonePercentage = controllerStick->GetDeadzonePercentage();