Frontend: Hook up right stick button to main menu bar
This commit is contained in:
parent
f314a26eee
commit
f22de715c7
|
@ -129,6 +129,8 @@ bool SDLInterface::CreateImGuiContext()
|
||||||
{
|
{
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGui::GetIO().IniFilename = nullptr;
|
ImGui::GetIO().IniFilename = nullptr;
|
||||||
|
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard | ImGuiConfigFlags_NavEnableGamepad;
|
||||||
|
ImGui::GetIO().BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
||||||
|
|
||||||
if (!ImGui_ImplSDL2_InitForOpenGL(m_window, m_gl_context) || !ImGui_ImplOpenGL3_Init())
|
if (!ImGui_ImplSDL2_InitForOpenGL(m_window, m_gl_context) || !ImGui_ImplOpenGL3_Init())
|
||||||
return false;
|
return false;
|
||||||
|
@ -531,6 +533,12 @@ void SDLInterface::HandleSDLEvent(const SDL_Event* event)
|
||||||
case SDL_CONTROLLERBUTTONDOWN:
|
case SDL_CONTROLLERBUTTONDOWN:
|
||||||
case SDL_CONTROLLERBUTTONUP:
|
case SDL_CONTROLLERBUTTONUP:
|
||||||
{
|
{
|
||||||
|
if (event->type == SDL_CONTROLLERBUTTONDOWN && event->cbutton.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
|
||||||
|
{
|
||||||
|
// focus the menu bar
|
||||||
|
m_focus_main_menu_bar = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_controller)
|
if (m_controller)
|
||||||
HandleSDLControllerButtonEventForController(event, m_controller.get());
|
HandleSDLControllerButtonEventForController(event, m_controller.get());
|
||||||
}
|
}
|
||||||
|
@ -679,6 +687,12 @@ void SDLInterface::DrawMainMenuBar()
|
||||||
|
|
||||||
const bool system_enabled = static_cast<bool>(m_system);
|
const bool system_enabled = static_cast<bool>(m_system);
|
||||||
|
|
||||||
|
if (m_focus_main_menu_bar)
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup("System");
|
||||||
|
m_focus_main_menu_bar = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("System"))
|
if (ImGui::BeginMenu("System"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Reset", nullptr, false, system_enabled))
|
if (ImGui::MenuItem("Reset", nullptr, false, system_enabled))
|
||||||
|
|
|
@ -119,6 +119,7 @@ private:
|
||||||
u32 m_last_global_tick_counter = 0;
|
u32 m_last_global_tick_counter = 0;
|
||||||
Timer m_fps_timer;
|
Timer m_fps_timer;
|
||||||
|
|
||||||
|
bool m_focus_main_menu_bar = false;
|
||||||
bool m_about_window_open = false;
|
bool m_about_window_open = false;
|
||||||
bool m_speed_limiter_enabled = true;
|
bool m_speed_limiter_enabled = true;
|
||||||
bool m_speed_limiter_temp_disabled = false;
|
bool m_speed_limiter_temp_disabled = false;
|
||||||
|
|
Loading…
Reference in New Issue