diff --git a/source/frontend/StarGraphicsMenu.cpp b/source/frontend/StarGraphicsMenu.cpp index efce444..3974453 100644 --- a/source/frontend/StarGraphicsMenu.cpp +++ b/source/frontend/StarGraphicsMenu.cpp @@ -9,10 +9,12 @@ #include "StarButtonWidget.hpp" #include "StarOrderedSet.hpp" #include "StarJsonExtra.hpp" +#include "StarShadersMenu.hpp" namespace Star { -GraphicsMenu::GraphicsMenu() { +GraphicsMenu::GraphicsMenu(PaneManager* manager,UniverseClientPtr client) + : m_paneManager(manager) { GuiReader reader; reader.registerCallback("cancel", [&](Widget*) { @@ -103,10 +105,14 @@ GraphicsMenu::GraphicsMenu() { Root::singleton().configuration()->set("newLighting", checked); syncGui(); }); + reader.registerCallback("showShadersMenu", [=](Widget*) { + displayShaders(); + }); auto assets = Root::singleton().assets(); - Json paneLayout = assets->json("/interface/windowconfig/graphicsmenu.config:paneLayout"); + auto config = assets->json("/interface/windowconfig/graphicsmenu.config"); + Json paneLayout = config.get("paneLayout"); m_interfaceScaleList = jsonToIntList(assets->json("/interface/windowconfig/graphicsmenu.config:interfaceScaleList")); m_resList = jsonToVec2UList(assets->json("/interface/windowconfig/graphicsmenu.config:resolutionList")); @@ -122,6 +128,8 @@ GraphicsMenu::GraphicsMenu() { initConfig(); syncGui(); + + m_shadersMenu = make_shared(assets->json(config.getString("shadersPanePath", "/interface/opensb/shaders/shaders.config")), client); } void GraphicsMenu::show() { @@ -240,6 +248,10 @@ void GraphicsMenu::apply() { } } +void GraphicsMenu::displayShaders() { + m_paneManager->displayPane(PaneLayer::ModalWindow, m_shadersMenu); +} + void GraphicsMenu::applyWindowSettings() { auto configuration = Root::singleton().configuration(); auto appController = GuiContext::singleton().applicationController(); @@ -253,4 +265,4 @@ void GraphicsMenu::applyWindowSettings() { appController->setNormalWindow(jsonToVec2U(configuration->get("windowedResolution"))); } -} \ No newline at end of file +}