Update StarGraphicsMenu.cpp

This commit is contained in:
Bottinator22 2024-12-18 22:26:35 -08:00 committed by GitHub
parent 1303f54e30
commit e12860ad25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<ShadersMenu>(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")));
}
}
}