Skip to content

Commit

Permalink
stick sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai committed Dec 21, 2023
1 parent 9b94761 commit f937654
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f937654

Please sign in to comment.