diff options
Diffstat (limited to 'src/port/ui')
| -rw-r--r-- | src/port/ui/ImguiUI.cpp | 113 | ||||
| -rw-r--r-- | src/port/ui/Menu.cpp | 28 | ||||
| -rw-r--r-- | src/port/ui/Menu.h | 6 | ||||
| -rw-r--r-- | src/port/ui/MenuTypes.h | 9 | ||||
| -rw-r--r-- | src/port/ui/PortMenu.cpp | 34 | ||||
| -rw-r--r-- | src/port/ui/UIWidgets.cpp | 8 | ||||
| -rw-r--r-- | src/port/ui/UIWidgets.h | 8 |
7 files changed, 105 insertions, 101 deletions
diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 7ee262cb4..0d1342c08 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -16,6 +16,7 @@ #include <imgui_internal.h> #include <libultraship/libultraship.h> #include <fast/Fast3dWindow.h> +#include <fast/Fast3dGui.h> #include "port/Engine.h" #include "PortMenu.h" @@ -40,7 +41,7 @@ std::shared_ptr<Ship::GuiWindow> mTrackPropertiesWindow; std::shared_ptr<Ship::GuiWindow> mContentBrowserWindow; void SetupGuiElements() { - auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); + auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui(); // mGameMenuBar = std::make_shared<GameMenuBar>("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0)); // gui->SetMenuBar(mGameMenuBar); @@ -155,23 +156,23 @@ void DrawSettingsMenu() { // }; // // ImGui::Text("Audio API (Needs reload)"); - // auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend(); + // auto currentAudioBackend = Ship::Context::GetRawInstance()->GetAudio()->GetCurrentAudioBackend(); // - // if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + // if (Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { // UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); // } // if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) { // for (uint8_t i = 0; i < - // Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { + // Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { // auto backend = - // Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; if + // Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; if // (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) { - // Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(backend); + // Ship::Context::GetRawInstance()->GetAudio()->SetCurrentAudioBackend(backend); // } // } // ImGui::EndCombo(); // } - // if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + // if (Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { // UIWidgets::ReEnableComponent(""); // } // @@ -219,7 +220,7 @@ void DrawSettingsMenu() { // UIWidgets::Spacer(0); // // // Previously was running every frame, and nothing was setting it? Maybe a bad copy/paste? - // // Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", + // // Ship::Context::GetRawInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", // 1)); // // UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but // // effective form of anti-aliasing"); @@ -229,18 +230,18 @@ void DrawSettingsMenu() { // { .tooltip = // "Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel" // })) { - // Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1)); + // Ship::Context::GetRawInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1)); // } // #endif // // { // FPS Slider // const int minFps = 30; // static int maxFps; - // if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == - // Ship::WindowBackend::FAST3D_DXGI_DX11) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == + // Fast::WindowBackend::FAST3D_DXGI_DX11) { // maxFps = 360; // } else { - // maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + // maxFps = Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(); // } // int currentFps = 0; // #ifdef __WIIU__ @@ -302,18 +303,18 @@ void DrawSettingsMenu() { // currentFps = 60; // } // CVarSetInteger("gInterpolationFPS", currentFps); - // Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + // Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); // #else // bool matchingRefreshRate = // CVarGetInteger("gMatchRefreshRate", 0) && - // Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != - // Ship::WindowBackend::FAST3D_DXGI_DX11; + // Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() != + // Fast::WindowBackend::FAST3D_DXGI_DX11; // UIWidgets::CVarSliderInt((currentFps == 20) ? "FPS: Original (20)" : "FPS: %d", "gInterpolationFPS", // minFps, // maxFps, 1, { .disabled = matchingRefreshRate }); // #endif - // if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == - // Ship::WindowBackend::FAST3D_DXGI_DX11) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == + // Fast::WindowBackend::FAST3D_DXGI_DX11) { // UIWidgets::Tooltip( // "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. " // "This is purely " @@ -327,14 +328,14 @@ void DrawSettingsMenu() { // } // } // END FPS Slider // - // if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == - // Ship::WindowBackend::FAST3D_DXGI_DX11) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == + // Fast::WindowBackend::FAST3D_DXGI_DX11) { // UIWidgets::Spacer(0); // if (ImGui::Button("Match Refresh Rate")) { - // int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + // int hz = Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(); // if (hz >= 30 && hz <= 360) { // CVarSetInteger("gInterpolationFPS", hz); - // Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + // Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); // } // } // } else { @@ -343,8 +344,8 @@ void DrawSettingsMenu() { // // UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate"); // - // if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == - // Ship::WindowBackend::FAST3D_DXGI_DX11) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == + // Fast::WindowBackend::FAST3D_DXGI_DX11) { // UIWidgets::PaddedEnhancementSliderInt( // CVarGetInteger("gExtraLatencyThreshold", 0) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS", // "##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 0, true, true, false); @@ -357,53 +358,53 @@ void DrawSettingsMenu() { // // UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); // - // static std::unordered_map<Ship::WindowBackend, const char*> windowBackendNames = { - // { Ship::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, - // { Ship::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, - // { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" }, + // static std::unordered_map<Fast::WindowBackend, const char*> windowBackendNames = { + // { Fast::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, + // { Fast::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, + // { Fast::WindowBackend::FAST3D_SDL_METAL, "Metal" }, // }; // // ImGui::Text("Renderer API (Needs reload)"); - // Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend(); - // Ship::WindowBackend configWindowBackend; - // int 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 = Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend(); + // Fast::WindowBackend configWindowBackend; + // int configWindowBackendId = 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; // } // - // if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { // UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); // } // if (ImGui::BeginCombo("##RApi", windowBackendNames[configWindowBackend])) { // for (size_t i = 0; i < - // Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); + // Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends()->size(); // i++) { - // auto backend = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i]; + // auto backend = Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i]; // if (ImGui::Selectable(windowBackendNames[backend], backend == configWindowBackend)) { - // Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", + // Ship::Context::GetRawInstance()->GetConfig()->SetInt("Window.Backend.Id", // static_cast<int>(backend)); - // Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name", + // Ship::Context::GetRawInstance()->GetConfig()->SetString("Window.Backend.Name", // windowBackendNames[backend]); - // Ship::Context::GetInstance()->GetConfig()->Save(); + // Ship::Context::GetRawInstance()->GetConfig()->Save(); // } // } // ImGui::EndCombo(); // } - // if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { // UIWidgets::ReEnableComponent(""); // } // - // if (Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { + // if (Ship::Context::GetRawInstance()->GetWindow()->CanDisableVerticalSync()) { // UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); // } // - // if (Ship::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) { + // if (Ship::Context::GetRawInstance()->GetWindow()->SupportsWindowedFullscreen()) { // UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false); // } // - // if (Ship::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) { + // if (Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SupportsViewports()) { // UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false, // false, "", // UIWidgets::CheckboxGraphics::Cross, true); @@ -419,7 +420,7 @@ void DrawSettingsMenu() { // // UIWidgets::Spacer(0); // - // Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); + // Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); // // ImGui::EndMenu(); // } @@ -428,26 +429,28 @@ void DrawSettingsMenu() { void DrawMenuBarIcon() { static bool gameIconLoaded = false; if (!gameIconLoaded) { - // Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", + // Ship::Context::GetRawInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", // "textures/icons/gIcon.png"); gameIconLoaded = false; } - if (Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon")) { + if (auto fast3dGui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())) { + if (fast3dGui->GetTextureByName("Game_Icon")) { #ifdef __SWITCH__ - ImVec2 iconSize = ImVec2(20.0f, 20.0f); - float posScale = 1.0f; + ImVec2 iconSize = ImVec2(20.0f, 20.0f); + float posScale = 1.0f; #elif defined(__WIIU__) - ImVec2 iconSize = ImVec2(16.0f * 2, 16.0f * 2); - float posScale = 2.0f; + ImVec2 iconSize = ImVec2(16.0f * 2, 16.0f * 2); + float posScale = 2.0f; #else - ImVec2 iconSize = ImVec2(20.0f, 20.0f); - float posScale = 1.5f; + ImVec2 iconSize = ImVec2(20.0f, 20.0f); + float posScale = 1.5f; #endif - ImGui::SetCursorPos(ImVec2(5, 2.5f) * posScale); - ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize); - ImGui::SameLine(); - ImGui::SetCursorPos(ImVec2(25, 0) * posScale); + ImGui::SetCursorPos(ImVec2(5, 2.5f) * posScale); + ImGui::Image(fast3dGui->GetTextureByName("Game_Icon"), iconSize); + ImGui::SameLine(); + ImGui::SetCursorPos(ImVec2(25, 0) * posScale); + } } } 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(); diff --git a/src/port/ui/Menu.h b/src/port/ui/Menu.h index 7e84e5d26..67bdae8ec 100644 --- a/src/port/ui/Menu.h +++ b/src/port/ui/Menu.h @@ -48,9 +48,9 @@ class Menu : public GuiWindow { ImGuiTextFilter menuSearch; uint8_t searchSidebarIndex; UIWidgets::Colors defaultThemeIndex; - std::shared_ptr<std::vector<Ship::WindowBackend>> availableWindowBackends; - std::unordered_map<Ship::WindowBackend, const char*> availableWindowBackendsMap; - Ship::WindowBackend configWindowBackend; + std::shared_ptr<std::vector<int32_t>> availableWindowBackends; + std::unordered_map<int32_t, const char*> availableWindowBackendsMap; + int32_t configWindowBackend; std::unordered_map<uint32_t, disabledInfo> disabledMap; std::vector<disabledInfo> disabledVector; diff --git a/src/port/ui/MenuTypes.h b/src/port/ui/MenuTypes.h index e86550055..b7781f2a2 100644 --- a/src/port/ui/MenuTypes.h +++ b/src/port/ui/MenuTypes.h @@ -2,6 +2,7 @@ #define MENUTYPES_H #include <libultraship/libultraship.h> +#include <fast/Fast3dWindow.h> #include "UIWidgets.h" typedef enum { @@ -260,10 +261,10 @@ static const std::unordered_map<Ship::AudioBackend, const char*> audioBackendsMa { Ship::AudioBackend::COREAUDIO, "CoreAudio" }, }; -static const std::unordered_map<Ship::WindowBackend, const char*> windowBackendsMap = { - { Ship::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, - { Ship::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, - { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" }, +static const std::unordered_map<int32_t, const char*> windowBackendsMap = { + { Fast::WindowBackend::FAST3D_DXGI_DX11, "DirectX" }, + { Fast::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" }, + { Fast::WindowBackend::FAST3D_SDL_METAL, "Metal" }, }; struct MenuInit { diff --git a/src/port/ui/PortMenu.cpp b/src/port/ui/PortMenu.cpp index dfef9b87a..7155ca81d 100644 --- a/src/port/ui/PortMenu.cpp +++ b/src/port/ui/PortMenu.cpp @@ -100,8 +100,8 @@ void PortMenu::AddSettings() { #ifndef __SWITCH__ AddWidget(path, "Toggle Fullscreen", WIDGET_CHECKBOX) .ValuePointer(&isFullscreen) - .PreFunc([](WidgetInfo& info) { isFullscreen = Ship::Context::GetInstance()->GetWindow()->IsFullscreen(); }) - .Callback([](WidgetInfo& info) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); }) + .PreFunc([](WidgetInfo& info) { isFullscreen = Ship::Context::GetRawInstance()->GetWindow()->IsFullscreen(); }) + .Callback([](WidgetInfo& info) { Ship::Context::GetRawInstance()->GetWindow()->ToggleFullscreen(); }) .Options(CheckboxOptions().Tooltip("Toggles Fullscreen On/Off.")); #endif @@ -148,7 +148,7 @@ void PortMenu::AddSettings() { AddWidget(path, "Cursor Always Visible", WIDGET_CVAR_CHECKBOX) .CVar("gSettings.CursorVisibility") .Callback([](WidgetInfo& info) { - Ship::Context::GetInstance()->GetWindow()->SetForceCursorVisibility( + Ship::Context::GetRawInstance()->GetWindow()->SetForceCursorVisibility( CVarGetInteger("gSettings.CursorVisibility", 0)); }) .Options(CheckboxOptions().Tooltip("Makes the cursor always visible, even in full screen.")); @@ -175,7 +175,7 @@ void PortMenu::AddSettings() { #ifndef __SWITCH__ AddWidget(path, "Open App Files Folder", WIDGET_BUTTON) .Callback([](WidgetInfo& info) { - std::string filesPath = Ship::Context::GetInstance()->GetAppDirectoryPath(); + std::string filesPath = Ship::Context::GetRawInstance()->GetAppDirectoryPath(); SDL_OpenURL(std::string("file:///" + std::filesystem::absolute(filesPath).string()).c_str()); }) .Options(ButtonOptions().Tooltip("Opens the folder that contains the save and mods folders, etc.")); @@ -217,13 +217,13 @@ void PortMenu::AddSettings() { // Graphics Settings static int32_t maxFps; const char* tooltip = ""; - if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) { + if (Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == Fast::WindowBackend::FAST3D_DXGI_DX11) { maxFps = MAX_FPS; tooltip = "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is " "purely visual and does not impact game logic, execution of glitches etc.\n\nA higher target " "FPS than your monitor's refresh rate will waste resources, and might give a worse result."; } else { - maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + maxFps = Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(); tooltip = "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is " "purely visual and does not impact game logic, execution of glitches etc."; } @@ -234,7 +234,7 @@ void PortMenu::AddSettings() { AddWidget(path, "Internal Resolution: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT) .CVar(CVAR_INTERNAL_RESOLUTION) .Callback([](WidgetInfo& info) { - Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier( + Ship::Context::GetRawInstance()->GetWindow()->SetResolutionMultiplier( CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1)); }) .PreFunc([](WidgetInfo& info) { @@ -260,7 +260,7 @@ void PortMenu::AddSettings() { AddWidget(path, "Anti-aliasing (MSAA): %d", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_MSAA_VALUE) .Callback([](WidgetInfo& info) { - Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1)); + Ship::Context::GetRawInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1)); }) .Options( IntSliderOptions() @@ -289,10 +289,10 @@ void PortMenu::AddSettings() { .Options(IntSliderOptions().Tooltip(tooltip).Min(30).Max(maxFps).DefaultValue(30)); AddWidget(path, "Match Refresh Rate", WIDGET_BUTTON) .Callback([](WidgetInfo& info) { - int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + int hz = Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(); if (hz >= 30 && hz <= MAX_FPS) { CVarSetInteger("gInterpolationFPS", hz); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } }) .PreFunc([](WidgetInfo& info) { info.isHidden = mPortMenu->disabledMap.at(DISABLE_FOR_NOT_DIRECTX).active; }) @@ -651,29 +651,29 @@ void PortMenu::InitElement() { "Debug Mode is Disabled" } }, { DISABLE_FOR_NO_VSYNC, { [](disabledInfo& info) -> bool { - return !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync(); + return !Ship::Context::GetRawInstance()->GetWindow()->CanDisableVerticalSync(); }, "Disabling VSync not supported" } }, { DISABLE_FOR_NO_WINDOWED_FULLSCREEN, { [](disabledInfo& info) -> bool { - return !Ship::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen(); + return !Ship::Context::GetRawInstance()->GetWindow()->SupportsWindowedFullscreen(); }, "Windowed Fullscreen not supported" } }, { DISABLE_FOR_NO_MULTI_VIEWPORT, { [](disabledInfo& info) -> bool { - return !Ship::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports(); + return !Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SupportsViewports(); }, "Multi-viewports not supported" } }, { DISABLE_FOR_NOT_DIRECTX, { [](disabledInfo& info) -> bool { - return Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != - Ship::WindowBackend::FAST3D_DXGI_DX11; + return Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() != + Fast::WindowBackend::FAST3D_DXGI_DX11; }, "Available Only on DirectX" } }, { DISABLE_FOR_DIRECTX, { [](disabledInfo& info) -> bool { - return Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == - Ship::WindowBackend::FAST3D_DXGI_DX11; + return Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() == + Fast::WindowBackend::FAST3D_DXGI_DX11; }, "Not Available on DirectX" } }, { DISABLE_FOR_MATCH_REFRESH_RATE_ON, diff --git a/src/port/ui/UIWidgets.cpp b/src/port/ui/UIWidgets.cpp index 2495aef4e..8d9d1c2e4 100644 --- a/src/port/ui/UIWidgets.cpp +++ b/src/port/ui/UIWidgets.cpp @@ -291,7 +291,7 @@ bool CVarCheckbox(const char* label, const char* cvarName, const CheckboxOptions bool value = (bool)CVarGetInteger(cvarName, options.defaultValue); if (Checkbox(label, &value, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; @@ -404,7 +404,7 @@ bool CVarSliderInt(const char* label, const char* cvarName, const IntSliderOptio int32_t value = CVarGetInteger(cvarName, options.defaultValue); if (SliderInt(label, &value, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; @@ -514,7 +514,7 @@ bool CVarSliderFloat(const char* label, const char* cvarName, const FloatSliderO float value = CVarGetFloat(cvarName, options.defaultValue); if (SliderFloat(label, &value, options)) { CVarSetFloat(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; @@ -531,7 +531,7 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul color.b = (uint8_t)(colorVec.z * 255.0f); color.a = (uint8_t)(colorVec.w * 255.0f); CVarSetColor(cvarName, color); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); changed = true; } PopStyleCombobox(); diff --git a/src/port/ui/UIWidgets.h b/src/port/ui/UIWidgets.h index 66fbc2d0e..342c421f3 100644 --- a/src/port/ui/UIWidgets.h +++ b/src/port/ui/UIWidgets.h @@ -431,7 +431,7 @@ namespace UIWidgets { int32_t value = CVarGetInteger(cvarName, options.defaultIndex); if (Combobox(label, &value, comboSource, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); ShipInit::Init(cvarName); dirty = true; } @@ -670,7 +670,7 @@ namespace UIWidgets { int32_t value = CVarGetInteger(cvarName, options.defaultIndex); if (Combobox<T>(label, &value, comboMap, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; @@ -682,7 +682,7 @@ namespace UIWidgets { int32_t value = CVarGetInteger(cvarName, options.defaultIndex); if (Combobox<T>(label, &value, comboVector, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; @@ -694,7 +694,7 @@ namespace UIWidgets { int32_t value = CVarGetInteger(cvarName, options.defaultIndex); if (Combobox<T>(label, &value, comboArray, options)) { CVarSetInteger(cvarName, value); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); dirty = true; } return dirty; |
