Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-12-19 19:08:59 +1100
committerGitHub <noreply@github.com>2024-12-19 19:08:59 +1100
commit63903276e5e1c3f96629d87cdaab9e868368b343 (patch)
treee335b36c27fba80e56605b95e6fd3f4993bd6f58 /source/frontend
parent2bf5be1af36fa53fc686bb893dc97e5ed10ddaa4 (diff)
parent300b8f2dbae631fdddeafaee683f450418e5cc57 (diff)
Merge pull request #157 from Bottinator22/main
Allow post process shaders to be grouped up and enabled/disabled via Lua or a shaders menu
Diffstat (limited to 'source/frontend')
-rw-r--r--source/frontend/CMakeLists.txt4
-rw-r--r--source/frontend/StarGraphicsMenu.cpp18
-rw-r--r--source/frontend/StarGraphicsMenu.hpp10
-rw-r--r--source/frontend/StarMainInterface.cpp4
-rw-r--r--source/frontend/StarOptionsMenu.cpp4
-rw-r--r--source/frontend/StarOptionsMenu.hpp3
-rw-r--r--source/frontend/StarShadersMenu.cpp22
-rw-r--r--source/frontend/StarShadersMenu.hpp22
-rw-r--r--source/frontend/StarTitleScreen.cpp8
-rw-r--r--source/frontend/StarTitleScreen.hpp5
10 files changed, 84 insertions, 16 deletions
diff --git a/source/frontend/CMakeLists.txt b/source/frontend/CMakeLists.txt
index 0934308..b619e90 100644
--- a/source/frontend/CMakeLists.txt
+++ b/source/frontend/CMakeLists.txt
@@ -55,6 +55,7 @@ SET (star_frontend_HEADERS
StarSimpleTooltip.hpp
StarSongbookInterface.hpp
StarStatusPane.hpp
+ StarShadersMenu.hpp
StarTeleportDialog.hpp
StarVoice.hpp
StarVoiceLuaBindings.hpp
@@ -107,6 +108,7 @@ SET (star_frontend_SOURCES
StarSimpleTooltip.cpp
StarSongbookInterface.cpp
StarStatusPane.cpp
+ StarShadersMenu.cpp
StarTeleportDialog.cpp
StarVoice.cpp
StarVoiceLuaBindings.cpp
@@ -118,4 +120,4 @@ ADD_LIBRARY (star_frontend OBJECT ${star_frontend_SOURCES} ${star_frontend_HEADE
IF(STAR_PRECOMPILED_HEADERS)
TARGET_PRECOMPILE_HEADERS (star_frontend REUSE_FROM star_core)
-ENDIF() \ No newline at end of file
+ENDIF()
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<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")));
}
-} \ No newline at end of file
+}
diff --git a/source/frontend/StarGraphicsMenu.hpp b/source/frontend/StarGraphicsMenu.hpp
index 6d03652..c212f71 100644
--- a/source/frontend/StarGraphicsMenu.hpp
+++ b/source/frontend/StarGraphicsMenu.hpp
@@ -1,14 +1,17 @@
#pragma once
#include "StarPane.hpp"
+#include "StarMainInterfaceTypes.hpp"
+#include "StarUniverseClient.hpp"
namespace Star {
STAR_CLASS(GraphicsMenu);
+STAR_CLASS(ShadersMenu);
class GraphicsMenu : public Pane {
public:
- GraphicsMenu();
+ GraphicsMenu(PaneManager* manager,UniverseClientPtr client);
void show() override;
void dismissed() override;
@@ -23,6 +26,8 @@ private:
void apply();
void applyWindowSettings();
+
+ void displayShaders();
List<Vec2U> m_resList;
List<int> m_interfaceScaleList;
@@ -30,6 +35,9 @@ private:
List<float> m_cameraSpeedList;
JsonObject m_localChanges;
+
+ ShadersMenuPtr m_shadersMenu;
+ PaneManager* m_paneManager;
};
}
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 41eceb7..8468f7f 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -117,7 +117,7 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter,
m_codexInterface = make_shared<CodexInterface>(m_client->mainPlayer());
m_paneManager.registerPane(MainInterfacePanes::Codex, PaneLayer::Window, m_codexInterface);
- m_optionsMenu = make_shared<OptionsMenu>(&m_paneManager);
+ m_optionsMenu = make_shared<OptionsMenu>(&m_paneManager,m_client);
m_paneManager.registerPane(MainInterfacePanes::Options, PaneLayer::ModalWindow, m_optionsMenu);
m_popupInterface = make_shared<PopupInterface>();
@@ -1604,4 +1604,4 @@ void MainInterface::displayScriptPane(ScriptPanePtr& scriptPane, EntityId source
}
}
-} \ No newline at end of file
+}
diff --git a/source/frontend/StarOptionsMenu.cpp b/source/frontend/StarOptionsMenu.cpp
index 0ea1fa1..8253f1f 100644
--- a/source/frontend/StarOptionsMenu.cpp
+++ b/source/frontend/StarOptionsMenu.cpp
@@ -13,7 +13,7 @@
namespace Star {
-OptionsMenu::OptionsMenu(PaneManager* manager)
+OptionsMenu::OptionsMenu(PaneManager* manager, UniverseClientPtr client)
: m_sfxRange(0, 100), m_musicRange(0, 100), m_paneManager(manager) {
auto root = Root::singletonPtr();
auto assets = root->assets();
@@ -90,7 +90,7 @@ OptionsMenu::OptionsMenu(PaneManager* manager)
m_voiceSettingsMenu = make_shared<VoiceSettingsMenu>(assets->json(config.getString("voiceSettingsPanePath", "/interface/opensb/voicechat/voicechat.config")));
m_modBindingsMenu = make_shared<BindingsMenu>(assets->json(config.getString("bindingsPanePath", "/interface/opensb/bindings/bindings.config")));
m_keybindingsMenu = make_shared<KeybindingsMenu>();
- m_graphicsMenu = make_shared<GraphicsMenu>();
+ m_graphicsMenu = make_shared<GraphicsMenu>(manager,client);
initConfig();
}
diff --git a/source/frontend/StarOptionsMenu.hpp b/source/frontend/StarOptionsMenu.hpp
index 4bc36ad..9fde1ac 100644
--- a/source/frontend/StarOptionsMenu.hpp
+++ b/source/frontend/StarOptionsMenu.hpp
@@ -3,6 +3,7 @@
#include "StarPane.hpp"
#include "StarConfiguration.hpp"
#include "StarMainInterfaceTypes.hpp"
+#include "StarUniverseClient.hpp"
namespace Star {
@@ -17,7 +18,7 @@ STAR_CLASS(OptionsMenu);
class OptionsMenu : public Pane {
public:
- OptionsMenu(PaneManager* manager);
+ OptionsMenu(PaneManager* manager, UniverseClientPtr client);
virtual void show() override;
diff --git a/source/frontend/StarShadersMenu.cpp b/source/frontend/StarShadersMenu.cpp
new file mode 100644
index 0000000..4e15b66
--- /dev/null
+++ b/source/frontend/StarShadersMenu.cpp
@@ -0,0 +1,22 @@
+#include "StarShadersMenu.hpp"
+
+namespace Star {
+
+ShadersMenu::ShadersMenu(Json const& config, UniverseClientPtr client) : BaseScriptPane(config) {
+ m_client = std::move(client);
+}
+
+void ShadersMenu::show() {
+ BaseScriptPane::show();
+}
+
+void ShadersMenu::displayed() {
+ m_script.setLuaRoot(m_client->luaRoot());
+ BaseScriptPane::displayed();
+}
+
+void ShadersMenu::dismissed() {
+ BaseScriptPane::dismissed();
+}
+
+}
diff --git a/source/frontend/StarShadersMenu.hpp b/source/frontend/StarShadersMenu.hpp
new file mode 100644
index 0000000..9b24b0d
--- /dev/null
+++ b/source/frontend/StarShadersMenu.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "StarBaseScriptPane.hpp"
+#include "StarUniverseClient.hpp"
+
+namespace Star {
+
+STAR_CLASS(ShadersMenu);
+
+class ShadersMenu : public BaseScriptPane {
+public:
+ ShadersMenu(Json const& config, UniverseClientPtr client);
+
+ virtual void show() override;
+ void displayed() override;
+ void dismissed() override;
+
+private:
+ UniverseClientPtr m_client;
+};
+
+}
diff --git a/source/frontend/StarTitleScreen.cpp b/source/frontend/StarTitleScreen.cpp
index 895e88a..b48ac13 100644
--- a/source/frontend/StarTitleScreen.cpp
+++ b/source/frontend/StarTitleScreen.cpp
@@ -18,7 +18,7 @@
namespace Star {
-TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer)
+TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer, UniverseClientPtr client)
: m_playerStorage(playerStorage), m_skipMultiPlayerConnection(false), m_mixer(mixer) {
m_titleState = TitleState::Quit;
@@ -43,7 +43,7 @@ TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer)
initCharSelectionMenu();
initCharCreationMenu();
initMultiPlayerMenu();
- initOptionsMenu();
+ initOptionsMenu(client);
initModsMenu();
resetState();
@@ -345,8 +345,8 @@ void TitleScreen::initMultiPlayerMenu() {
m_paneManager.registerPane("multiplayerMenu", PaneLayer::Hud, m_multiPlayerMenu);
}
-void TitleScreen::initOptionsMenu() {
- auto optionsMenu = make_shared<OptionsMenu>(&m_paneManager);
+void TitleScreen::initOptionsMenu(UniverseClientPtr client) {
+ auto optionsMenu = make_shared<OptionsMenu>(&m_paneManager,client);
optionsMenu->setAnchor(PaneAnchor::Center);
optionsMenu->lockPosition();
diff --git a/source/frontend/StarTitleScreen.hpp b/source/frontend/StarTitleScreen.hpp
index 65ebb57..9aaac96 100644
--- a/source/frontend/StarTitleScreen.hpp
+++ b/source/frontend/StarTitleScreen.hpp
@@ -4,6 +4,7 @@
#include "StarAmbient.hpp"
#include "StarRegisteredPaneManager.hpp"
#include "StarInterfaceCursor.hpp"
+#include "StarUniverseClient.hpp"
namespace Star {
@@ -39,7 +40,7 @@ enum class TitleState {
class TitleScreen {
public:
- TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer);
+ TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer, UniverseClientPtr client);
void renderInit(RendererPtr renderer);
@@ -80,7 +81,7 @@ private:
void initCharSelectionMenu();
void initCharCreationMenu();
void initMultiPlayerMenu();
- void initOptionsMenu();
+ void initOptionsMenu(UniverseClientPtr client);
void initModsMenu();
void renderCursor();