imgui_ctru: Use ConfigNavSwapGamepadButtons

Tells ImGui to swap the roles of A and B buttons instead of swapping the buttons in backend.
This commit is contained in:
alvinhochun 2025-04-01 18:00:05 +08:00 committed by GitHub
parent 5037297b7b
commit 57977bc531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,8 +105,8 @@ void updateGamepads (ImGuiIO &io_)
{
auto const buttonMapping = {
// clang-format off
std::make_pair (KEY_A, ImGuiKey_GamepadFaceDown), // A and B are swapped
std::make_pair (KEY_B, ImGuiKey_GamepadFaceRight), // this is more intuitive
std::make_pair (KEY_A, ImGuiKey_GamepadFaceRight),
std::make_pair (KEY_B, ImGuiKey_GamepadFaceDown),
std::make_pair (KEY_X, ImGuiKey_GamepadFaceUp),
std::make_pair (KEY_Y, ImGuiKey_GamepadFaceLeft),
std::make_pair (KEY_L, ImGuiKey_GamepadL1),
@ -225,6 +225,9 @@ bool imgui::ctru::init ()
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
io.BackendPlatformName = "3DS";
// enable Nintendo button layout
io.ConfigNavSwapGamepadButtons = true;
// disable mouse cursor
io.MouseDrawCursor = false;