diff options
Diffstat (limited to 'src/port/ui/Menu.cpp')
| -rw-r--r-- | src/port/ui/Menu.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/port/ui/Menu.cpp b/src/port/ui/Menu.cpp index 8a4f26104..d03848306 100644 --- a/src/port/ui/Menu.cpp +++ b/src/port/ui/Menu.cpp @@ -90,15 +90,15 @@ void Menu::RemoveSidebarSearch() { } void Menu::UpdateWindowBackendObjects() { - Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend(); - int32_t configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1); - if (Ship::Context::GetInstance()->GetWindow()->IsAvailableWindowBackend(configWindowBackendId)) { - configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId); + Fast::WindowBackend runningWindowBackend = static_cast<Fast::WindowBackend>(Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend()); + Fast::WindowBackend configWindowBackendId = static_cast<Fast::WindowBackend>(Ship::Context::GetRawInstance()->GetConfig()->GetInt("Window.Backend.Id", -1)); + if (Ship::Context::GetRawInstance()->GetWindow()->IsAvailableWindowBackend(configWindowBackendId)) { + configWindowBackend = static_cast<Fast::WindowBackend>(configWindowBackendId); } else { configWindowBackend = runningWindowBackend; } - availableWindowBackends = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends(); + availableWindowBackends = Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends(); for (auto& backend : *availableWindowBackends) { availableWindowBackendsMap[backend] = windowBackendsMap.at(backend); } @@ -269,14 +269,14 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me }; } break; case WIDGET_AUDIO_BACKEND: { - auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend(); + auto currentAudioBackend = Ship::Context::GetRawInstance()->GetAudio()->GetCurrentAudioBackend(); UIWidgets::ComboboxOptions options = {}; options.color = menuThemeIndex; options.tooltip = "Sets the audio API used by the game. Requires a relaunch to take effect."; - options.disabled = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1; + options.disabled = Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1; options.disabledTooltip = "Only one audio API is available on this platform."; if (UIWidgets::Combobox("Audio API", ¤tAudioBackend, audioBackendsMap, options)) { - Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend); + Ship::Context::GetRawInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend); } } break; case WIDGET_VIDEO_BACKEND: { @@ -287,11 +287,11 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me options.disabledTooltip = "Only one renderer API is available on this platform."; if (UIWidgets::Combobox("Renderer API (Needs reload)", &configWindowBackend, availableWindowBackendsMap, options)) { - Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", + Ship::Context::GetRawInstance()->GetConfig()->SetInt("Window.Backend.Id", (int32_t)(configWindowBackend)); - Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name", + Ship::Context::GetRawInstance()->GetConfig()->SetString("Window.Backend.Name", windowBackendsMap.at(configWindowBackend)); - Ship::Context::GetInstance()->GetConfig()->Save(); + Ship::Context::GetRawInstance()->GetConfig()->Save(); UpdateWindowBackendObjects(); } } break; @@ -411,7 +411,7 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me SPDLOG_ERROR(msg.c_str()); break; } - auto window = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow(widget.windowName); + auto window = Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow(widget.windowName); if (!window) { std::string msg = fmt::format("Error drawing window contents: windowName {} does not exist", widget.windowName); @@ -589,7 +589,7 @@ void Menu::DrawElement() { // Update gamepad navigation after close based on if other menus are still visible auto mImGuiIo = &ImGui::GetIO(); if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && - Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) { + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) { mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; } else { mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -673,7 +673,7 @@ void Menu::DrawElement() { if (!popped) { ToggleVisibility(); } - Ship::Context::GetInstance()->GetWindow()->Close(); + Ship::Context::GetRawInstance()->GetWindow()->Close(); } ImGui::PopStyleVar(); |
