Skip to content

Commit 64e93b4

Browse files
authored
Merge pull request #735 from nicolasnoble/pad-config-derp
Adding dpad keyboard config
2 parents 3a15445 + b870ceb commit 64e93b4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/core/pad.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,29 @@ bool PCSX::Pads::Pad::configure() {
483483
ImGui::PopStyleColor(2);
484484
}
485485
}
486+
for (auto i = 0; i < 4; i++) {
487+
ImGui::TableNextRow();
488+
ImGui::TableSetColumnIndex(1);
489+
ImGui::Text(c_dpadDirections[i]());
490+
ImGui::TableSetColumnIndex(0);
491+
bool hasToPop = false;
492+
const auto absI = i + 10;
493+
if (m_buttonToWait == absI) {
494+
const ImVec4 highlight = ImGui::GetStyle().Colors[ImGuiCol_TextDisabled];
495+
ImGui::PushStyleColor(ImGuiCol_Button, highlight);
496+
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, highlight);
497+
hasToPop = true;
498+
}
499+
500+
// The name of the mapped key
501+
const auto keyName = fmt::format("{}##{}", glfwKeyToString(getButtonFromGUIIndex(absI)), absI);
502+
if (ImGui::Button(keyName.c_str(), ImVec2{-1, 0})) {
503+
m_buttonToWait = absI;
504+
}
505+
if (hasToPop) {
506+
ImGui::PopStyleColor(2);
507+
}
508+
}
486509
ImGui::EndTable();
487510
}
488511

0 commit comments

Comments
 (0)