[FEATURE] Make "START" act as "A" button when -y is passed
shantigilbert opened this issue · 3 comments
Many times people seem to press START to choose the Yes or No options, but it seems that if you press START it acts as if the No options was chosen even if the Yes is highlighted.
An alternative (and probably better way) would be to make START act as the A button so that the highlighted item is chosen, but I can't seem to fully understand how or where the START button is defined.
Makes sense! Start is handled here:
Line 236 in 3e95de9
The easiest would probably be to change that code to return 21 instead of 0 in case the yes/no button mode is enabled.
To treat start as A in general, we could add another mapping here:
TvTextViewer/imgui_impl_sdl.cpp
Line 342 in 3e95de9
We would still need to change the other code though, because the start button handling currently happens before ImGui sees the event. It would also mean that start would not quit anymore if the user has selected the text box instead of the buttons.
It would also mean that start would not quit anymore if the user has selected the text box instead of the buttons.
How about we use Select (or whatever the equivalent is) for Quit and Start to be handled as A ?
something like
if (
event.type == SDL_QUIT ||
(event.type == SDL_CONTROLLERBUTTONDOWN &&
(event.cbutton.button == SDL_CONTROLLER_BUTTON_GUIDE || event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK)) ||
(event.type == SDL_WINDOWEVENT &&
event.window.event == SDL_WINDOWEVENT_CLOSE &&
event.window.windowID == SDL_GetWindowID(pWindow))
)
Although I am not sure the syntax is correct.
and
mapButton(ImGuiNavInput_Activate, SDL_CONTROLLER_BUTTON_A); // Cross / A
mapButton(ImGuiNavInput_Activate, SDL_CONTROLLER_BUTTON_START); // START button
This seems to work, I opened a PR just so you can review if I made a mistake elsewhere :)