From 0a035226d881cd0654b38cbcdfaae22aaac79b28 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:02:08 -0800 Subject: [PATCH 01/21] Update client.config.patch --- assets/opensb/client.config.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/opensb/client.config.patch b/assets/opensb/client.config.patch index 619a767..7bd18d6 100644 --- a/assets/opensb/client.config.patch +++ b/assets/opensb/client.config.patch @@ -10,5 +10,6 @@ "scissor" : false, "letterbox" : false }, - "postProcessLayers": [] + "postProcessLayers": [], + "postProcessGroups": {} } From 7253f4093215754898c05da32af154f08de88b1a Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:03:32 -0800 Subject: [PATCH 02/21] Update build.yml --- .github/workflows/build.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33ba3a5..925c2a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,14 +3,6 @@ name: Build on: workflow_dispatch: - push: - branches: - - "*" - - pull_request: - branches: - - "*" - jobs: build_windows: name: Build OpenStarbound Windows x64 @@ -232,4 +224,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: OpenStarbound-macOS-Silicon - path: dist/* \ No newline at end of file + path: dist/* From 209d89a07df54ee63754fc3d8137f1775a4cce17 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:05:55 -0800 Subject: [PATCH 03/21] Update StarClientApplication.cpp --- source/client/StarClientApplication.cpp | 41 ++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 71bec5d..7d8d321 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -434,6 +434,8 @@ void ClientApplication::getAudioData(int16_t* sampleData, size_t frameCount) { } } +auto postProcessGroupsRoot = "postProcessGroups"; + void ClientApplication::renderReload() { auto assets = m_root->assets(); auto renderer = Application::renderer(); @@ -464,18 +466,55 @@ void ClientApplication::renderReload() { loadEffectConfig("world"); + // define post process groups and set them to be enabled/disabled based on config + + auto config = m_root->configuration(); + if (!config->get(postProcessGroupsRoot).isType(Json::Type::Object)) + config->set(postProcessGroupsRoot, JsonObject()); + auto groupsConfig = config->get(postProcessGroupsRoot); + + m_postProcessGroups.clear(); + auto postProcessGroups = assets->json("/client.config:postProcessGroups").toObject(); + for (auto& pair : postProcessGroups) { + auto name = pair.first; + auto groupConfig = groupsConfig.opt(name); + auto def = pair.second.getBool("enabledDefault",true); + if (!groupConfig) + config->setPath(strf("{}.{}", postProcessGroupsRoot, name),JsonObject()); + m_postProcessGroups.add(name,PostProcessGroup{ groupConfig ? groupConfig.value().getBool("enabled", def) : def }); + } + + // define post process layers and optionally assign them to groups m_postProcessLayers.clear(); auto postProcessLayers = assets->json("/client.config:postProcessLayers").toArray(); for (auto& layer : postProcessLayers) { auto effects = jsonToStringList(layer.getArray("effects")); for (auto& effect : effects) loadEffectConfig(effect); - m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1) }); + PostProcessGroup* group = nullptr; + auto gname = layer.optString("group"); + if (gname) { + group = &m_postProcessGroups.get(gname.value()); + } + m_postProcessLayers.append(PostProcessLayer{ std::move(effects), (unsigned)layer.getUInt("passes", 1), group }); } loadEffectConfig("interface"); } +void ClientApplication::setPostProcessGroupEnabled(String group, bool enabled, Maybe save) { + m_postProcessGroups.get(group).enabled = enabled; + if (save && save.value()) + m_root->configuration()->setPath(strf("{}.{}.enabled", postProcessGroupsRoot, group),enabled); +} +bool ClientApplication::postProcessGroupEnabled(String group) { + return m_postProcessGroups.get(group).enabled; +} + +Json ClientApplication::postProcessGroups() { + return m_root->assets()->json("/client.config:postProcessGroups"); +} + void ClientApplication::changeState(MainAppState newState) { MainAppState oldState = m_state; m_state = newState; From e009a15ba7a851625627852f3fd8219e9ba962b5 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:06:56 -0800 Subject: [PATCH 04/21] Update StarClientApplication.cpp --- source/client/StarClientApplication.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 7d8d321..e22093c 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -24,6 +24,7 @@ #include "StarVoiceLuaBindings.hpp" #include "StarCameraLuaBindings.hpp" #include "StarClipboardLuaBindings.hpp" +#include "StarRenderingLuaBindings.hpp" #if defined STAR_SYSTEM_WINDOWS #include @@ -582,6 +583,7 @@ void ClientApplication::changeState(MainAppState newState) { m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks()); m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks()); m_universeClient->setLuaCallbacks("camera", LuaBindings::makeCameraCallbacks(&m_worldPainter->camera())); + m_universeClient->setLuaCallbacks("renderer", LuaBindings::makeRenderingCallbacks(this)); Json alwaysAllow = m_root->configuration()->getPath("safe.alwaysAllowClipboard"); m_universeClient->setLuaCallbacks("clipboard", LuaBindings::makeClipboardCallbacks(appController(), alwaysAllow && alwaysAllow.toBool())); From 226ff4e2788bb8f5c04eae629b777cf9b44112d7 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:07:58 -0800 Subject: [PATCH 05/21] Update StarClientApplication.hpp --- source/client/StarClientApplication.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/client/StarClientApplication.hpp b/source/client/StarClientApplication.hpp index 840dc9a..323f2b7 100644 --- a/source/client/StarClientApplication.hpp +++ b/source/client/StarClientApplication.hpp @@ -18,6 +18,11 @@ STAR_CLASS(Input); STAR_CLASS(Voice); class ClientApplication : public Application { +public: + void setPostProcessGroupEnabled(String group, bool enabled, Maybe save); + bool postProcessGroupEnabled(String group); + Json postProcessGroups(); + protected: virtual void startup(StringList const& cmdLineArgs) override; virtual void shutdown() override; @@ -53,9 +58,14 @@ private: String password; }; + struct PostProcessGroup { + bool enabled; + }; + struct PostProcessLayer { List effects; unsigned passes; + PostProcessGroup* group; }; void renderReload(); @@ -104,6 +114,7 @@ private: WorldRenderData m_renderData; MainInterfacePtr m_mainInterface; + StringMap m_postProcessGroups; List m_postProcessLayers; // Valid if main app state == SinglePlayer From b7aa4f6da681752eeba59750715baa01aa3654e0 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:09:19 -0800 Subject: [PATCH 06/21] Add files via upload --- source/client/StarRenderingLuaBindings.cpp | 21 +++++++++++++++++++++ source/client/StarRenderingLuaBindings.hpp | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 source/client/StarRenderingLuaBindings.cpp create mode 100644 source/client/StarRenderingLuaBindings.hpp diff --git a/source/client/StarRenderingLuaBindings.cpp b/source/client/StarRenderingLuaBindings.cpp new file mode 100644 index 0000000..4c9e7a2 --- /dev/null +++ b/source/client/StarRenderingLuaBindings.cpp @@ -0,0 +1,21 @@ +#include "StarRenderingLuaBindings.hpp" +#include "StarLuaConverters.hpp" +#include "StarClientApplication.hpp" + +namespace Star { + +LuaCallbacks LuaBindings::makeRenderingCallbacks(ClientApplication* app) { + LuaCallbacks callbacks; + + // if the last argument is defined and true, this change will also be saved to starbound.config and read on next game start, use for things such as an interface that does this + callbacks.registerCallbackWithSignature>("setPostProcessGroupEnabled", bind(mem_fn(&ClientApplication::setPostProcessGroupEnabled), app, _1, _2, _3)); + callbacks.registerCallbackWithSignature("postProcessGroupEnabled", bind(mem_fn(&ClientApplication::postProcessGroupEnabled), app, _1)); + + // not entirely necessary (root.assetJson can achieve the same purpose) but may as well + callbacks.registerCallbackWithSignature("postProcessGroups", bind(mem_fn(&ClientApplication::postProcessGroups), app)); + + return callbacks; +} + + +} diff --git a/source/client/StarRenderingLuaBindings.hpp b/source/client/StarRenderingLuaBindings.hpp new file mode 100644 index 0000000..68e709f --- /dev/null +++ b/source/client/StarRenderingLuaBindings.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "StarLua.hpp" + +namespace Star { + +STAR_CLASS(ClientApplication); + +namespace LuaBindings { + LuaCallbacks makeRenderingCallbacks(ClientApplication* app); +} + +} From 1d80822543c5f7cf949385a4a920538027f8f4ea Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:10:07 -0800 Subject: [PATCH 07/21] Update CMakeLists.txt --- source/client/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 57b8231..a6773d3 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -12,10 +12,12 @@ INCLUDE_DIRECTORIES ( SET (star_client_HEADERS StarClientApplication.hpp + StarRenderingLuaBindings.hpp ) SET (star_client_SOURCES StarClientApplication.cpp + StarRenderingLuaBindings.cpp ) IF (STAR_SYSTEM_WINDOWS) @@ -37,4 +39,4 @@ IF(UNIX) set_target_properties (starbound PROPERTIES LINK_FLAGS "-Wl,-rpath,'$ORIGIN'") ENDIF() -TARGET_LINK_LIBRARIES (starbound ${STAR_EXT_LIBS} ${STAR_EXT_GUI_LIBS}) \ No newline at end of file +TARGET_LINK_LIBRARIES (starbound ${STAR_EXT_LIBS} ${STAR_EXT_GUI_LIBS}) From 2ffe1146866193998e65129decc378a9665fc3a9 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:13:34 -0800 Subject: [PATCH 08/21] Update StarClientApplication.cpp --- source/client/StarClientApplication.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index e22093c..81b217f 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -406,10 +406,12 @@ void ClientApplication::render() { auto size = Vec2F(renderer->screenSize()); auto quad = renderFlatRect(RectF::withSize(size / -2, size), Vec4B::filled(0), 0.0f); for (auto& layer : m_postProcessLayers) { - for (unsigned i = 0; i < layer.passes; i++) { - for (auto& effect : layer.effects) { - renderer->switchEffectConfig(effect); - renderer->render(quad); + if (layer.group ? layer.group->enabled : true) { + for (unsigned i = 0; i < layer.passes; i++) { + for (auto& effect : layer.effects) { + renderer->switchEffectConfig(effect); + renderer->render(quad); + } } } } From 7bc0f942bc3a04df71d0df393f783d645257279b Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:21:32 -0800 Subject: [PATCH 09/21] Update StarMainInterface.cpp --- source/frontend/StarMainInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(m_client->mainPlayer()); m_paneManager.registerPane(MainInterfacePanes::Codex, PaneLayer::Window, m_codexInterface); - m_optionsMenu = make_shared(&m_paneManager); + m_optionsMenu = make_shared(&m_paneManager,m_client); m_paneManager.registerPane(MainInterfacePanes::Options, PaneLayer::ModalWindow, m_optionsMenu); m_popupInterface = make_shared(); @@ -1604,4 +1604,4 @@ void MainInterface::displayScriptPane(ScriptPanePtr& scriptPane, EntityId source } } -} \ No newline at end of file +} From 096ab486f651d803b8a7f50e448b50e17e907539 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:22:12 -0800 Subject: [PATCH 10/21] Update StarOptionsMenu.hpp --- source/frontend/StarOptionsMenu.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; From 1303f54e30f1d33b5f21b527cff000daf990ba04 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:23:54 -0800 Subject: [PATCH 11/21] Update StarOptionsMenu.cpp --- source/frontend/StarOptionsMenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(assets->json(config.getString("voiceSettingsPanePath", "/interface/opensb/voicechat/voicechat.config"))); m_modBindingsMenu = make_shared(assets->json(config.getString("bindingsPanePath", "/interface/opensb/bindings/bindings.config"))); m_keybindingsMenu = make_shared(); - m_graphicsMenu = make_shared(); + m_graphicsMenu = make_shared(manager,client); initConfig(); } From e12860ad25ec5c345ff2db209a26b2205953529d Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:26:35 -0800 Subject: [PATCH 12/21] Update StarGraphicsMenu.cpp --- source/frontend/StarGraphicsMenu.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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 +} From 0c4682d304d37e0c634ddf90dc49a0560310c9ab Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:26:59 -0800 Subject: [PATCH 13/21] Update StarGraphicsMenu.hpp --- source/frontend/StarGraphicsMenu.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 m_resList; List m_interfaceScaleList; @@ -30,6 +35,9 @@ private: List m_cameraSpeedList; JsonObject m_localChanges; + + ShadersMenuPtr m_shadersMenu; + PaneManager* m_paneManager; }; } From bf6969dc7df8a8f979085971d84a870d09528f85 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:28:39 -0800 Subject: [PATCH 14/21] Add files via upload --- source/frontend/StarShadersMenu.cpp | 22 ++++++++++++++++++++++ source/frontend/StarShadersMenu.hpp | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 source/frontend/StarShadersMenu.cpp create mode 100644 source/frontend/StarShadersMenu.hpp 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; +}; + +} From 9cff2ce433b676b10aad43e6304fb0c5216cbb39 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:30:16 -0800 Subject: [PATCH 15/21] Update CMakeLists.txt --- source/frontend/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() From 8dbbbcb0861583a650d83c8f7e0793eafe972bed Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:33:27 -0800 Subject: [PATCH 16/21] Update graphicsmenu.config.patch.lua --- .../windowconfig/graphicsmenu.config.patch.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/opensb/interface/windowconfig/graphicsmenu.config.patch.lua b/assets/opensb/interface/windowconfig/graphicsmenu.config.patch.lua index 7d7ab44..b17053a 100644 --- a/assets/opensb/interface/windowconfig/graphicsmenu.config.patch.lua +++ b/assets/opensb/interface/windowconfig/graphicsmenu.config.patch.lua @@ -13,6 +13,12 @@ local function shift(thing, x, y) return thing end +local function moveto(thing, otherthing) + thing.position[1] = otherthing.position[1] + thing.position[2] = otherthing.position[2] + return thing +end + -- patch function, called by the game function patch(config) local layout = config.paneLayout @@ -41,10 +47,14 @@ function patch(config) -- Create hardware cursor toggle shift(clone(layout, "multiTextureLabel", "hardwareCursorLabel"), 98, -11).value = "HARDWARE CURSOR" shift(clone(layout, "multiTextureCheckbox", "hardwareCursorCheckbox"), 99, -11) + + -- Create shader menu button + shift(moveto(clone(layout, "accept", "showShadersMenu"), layout.interfaceScaleSlider), 112, -2).caption = "Shaders" + shift(layout.title, 0, 24) shift(layout.resLabel, 0, 28) shift(layout.resSlider, 0, 28) shift(layout.resValueLabel, 0, 28) return config -end \ No newline at end of file +end From 20f0efdcb8af2d7ea2684762e695f460c5d75f34 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:34:58 -0800 Subject: [PATCH 17/21] add shader interface --- .../opensb/interface/opensb/shaders/body.png | Bin 0 -> 743 bytes .../interface/opensb/shaders/categoryname.png | Bin 0 -> 391 bytes .../interface/opensb/shaders/footer.png | Bin 0 -> 163 bytes .../opensb/interface/opensb/shaders/group.png | Bin 0 -> 80 bytes .../interface/opensb/shaders/groupback.png | Bin 0 -> 162 bytes .../interface/opensb/shaders/header.png | Bin 0 -> 4346 bytes .../interface/opensb/shaders/optionname.png | Bin 0 -> 197 bytes .../interface/opensb/shaders/shaders.config | 147 ++++++++++++ .../interface/opensb/shaders/shaders.lua | 219 ++++++++++++++++++ 9 files changed, 366 insertions(+) create mode 100644 assets/opensb/interface/opensb/shaders/body.png create mode 100644 assets/opensb/interface/opensb/shaders/categoryname.png create mode 100644 assets/opensb/interface/opensb/shaders/footer.png create mode 100644 assets/opensb/interface/opensb/shaders/group.png create mode 100644 assets/opensb/interface/opensb/shaders/groupback.png create mode 100644 assets/opensb/interface/opensb/shaders/header.png create mode 100644 assets/opensb/interface/opensb/shaders/optionname.png create mode 100644 assets/opensb/interface/opensb/shaders/shaders.config create mode 100644 assets/opensb/interface/opensb/shaders/shaders.lua diff --git a/assets/opensb/interface/opensb/shaders/body.png b/assets/opensb/interface/opensb/shaders/body.png new file mode 100644 index 0000000000000000000000000000000000000000..272ed29cb23d057e6c369893881c006c880ec096 GIT binary patch literal 743 zcmeAS@N?(olHy`uVBq!ia0y~yV4MJCpWt8vlE*~1KVo2DTIcEF7*cWT?R9IeW(SeB zKyK~jeDD0d%?r&9mvWn|Twl7%fum)HfMS2K*UVS$KaZ73v^};t-`6EV* zcb<8(Z4Pstb6VMBi+Q(BH%Glr63b({6wSC}xhW$96H`M2gMtDB2L}j|%{!!i`ph{l z1%(e=It-Zp94L?RirgM2!P>HY#a6wrhV}d&@A+98?s8IK1Ig}$cnant8t~K@92^(~ z1Q=LY7#JCWh^9QSC2$*P%!7FfVjltCH?9*VzI!bzrhaGtcV1H9sHTU#+rwU90%q`Z L^>bP0l+XkKH!ORL literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/opensb/shaders/categoryname.png b/assets/opensb/interface/opensb/shaders/categoryname.png new file mode 100644 index 0000000000000000000000000000000000000000..3019556043a9c3036ecc8f33573cfd6e6a496beb GIT binary patch literal 391 zcmV;20eJq2P)TrR426xA+w~lrYR=K?AhAJ$B^{{?q_~*;Ie}Sp8R>meCQS0|I7Uyn*Xt$JFbqSU z^Puuf*PQls=CW7C@l8iLUz5LDd(d%HhwiA1YaM;4xzrbC=1>!*T(L&ZIyQCJcVoWi zBU2ySoar1&`5$^!-Hqb>q%$>9+f!=Z3s>({#GgaXas4r~zn+D{+NJS98{#AmUo;fg zyxep?=A)$b63!vrlN?JqR!ZzczEsm05c8YbN%CF%L%uxB8s#<0cQ{iQO>?)TE4?zY z)fughO#Qx`-}cn#=tIpmuEpukIF8>00O*SI(+IJfdS|c^{!i%<&9PV&>!kuH_tP^zyNfJde=?U1Oo%m lA?jUs9EV3M0O$|(?jH(LP24s+jGzDj002ovPDHLkV1ifNxI+K{ literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/opensb/shaders/footer.png b/assets/opensb/interface/opensb/shaders/footer.png new file mode 100644 index 0000000000000000000000000000000000000000..426f8a6352da4b45c41074454618864c15284320 GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0y~yV4MJC^K-BP$x}aOz5`NOo-U3d6}R4AJ;-^$fQQAg ze963!eX~6-oadKJ`p;BsaQ#rO>~Y>R>34;b&xgV5OkMbRg8`S_cOwL#)NNk1w2<7zopr0L4->nE(I) literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/opensb/shaders/group.png b/assets/opensb/interface/opensb/shaders/group.png new file mode 100644 index 0000000000000000000000000000000000000000..66f5cdb3e8491ddf26d0453112042f3ab852c6cc GIT binary patch literal 80 zcmeAS@N?(olHy`uVBq!ia0vp^O+YNb2qYLjU7IBVq{Ka4978H@CI9GW<1;WZSisaS csL~`T#c-iQ`{C`Dh(eH3Pgg&ebxsLQ0KCZ*fdBvi literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/opensb/shaders/groupback.png b/assets/opensb/interface/opensb/shaders/groupback.png new file mode 100644 index 0000000000000000000000000000000000000000..ed838f3cdaa699d9e46ec9aacdf8b3c9c1cc372d GIT binary patch literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^O+YNb0VEjyAN!FBq%u8S978H@y`5?()S$q_V$Spa zN_*tbi*sBZ5@fPx85}5_oo4+ib?Fp~Ez4b_HrjETEuP14;_lOR^VaS3JF&FwLwVFr z#+DA-{rgPE<`Lnf|S_DC6y9=C!2r_Lm9A|2h;Pc7Pwa4Ml(fZ;w zav>Wr;75?yhe7Xe(~hE=>sK=DjkbMa)|qGYow=>+yzLua` z|9CmKPnY*~3cD`xi@}|XmSjEjd+eQ7@-&HMB|Mzl>~6lh^Tz8NF3h7>Nxrh~8y%$| z^&RSsYKE3R9avd>96A43x-tF5mxmqAZ!e|%e`YTF;)&NqJ8}qd%@8=vyQDRYIfz!xrBbUc`wuJa%EM`+vHt*R{K2Dw)R@0Cv$7Y zukyS8`pGBVzW2M1m6ax!=B8dps%ynUc}v=NJ2T4Ph>0J!Mz1W44j_9=xLxn>oMAX; zdimnEHsZjhZ(nFaH>JL=d9#PUurz!6KZj~sk#z%Uwv*p|{1oTK%TqK>Z@B$!rlF*v zp8Y|w@7FDdHXTTND*fIzIrp>tgUc2ksn&HYAM9y+^5m)X?xthX+-3Hjoc(z=PgbdM z&)1I}?#}7QPnAF4#aua0Jf3lRJ2-eI%az%@rg6qC+RW$nCEYf&yrytDFRb|D^F`I) zroEOSm2{mr)W8@{99(pL?uKa9_WieaK2xC8bXrbz&wuyGtXFoo{CE9VmP_gAaLU?? zzk9GVv1h~9zOU{dT5@0IZLhxipZnihD84p5WyOM*vO5Yl@Au|R8>slklZe*ON;y#1 zS@XZ@YsmTM{?apB6g7|U%zofp|G7{5`fk|ITpUQA-y$_?PJK`URTmSWy4HABGF&*Q zWBITT=wd+;$__znD`FzcRRJ0GfeImH#|Ao%V5q>`u~MUl^oR~nDHPO8ps0RTF;`#3 zS$S;59a>wAfdD}uvuG?B2t}Bf9aC``I9ALAhN>=dl^t8-@uH5f1W<#{pd)ctOsJ)? zJG7`x;{8maGj9|EzS*%#Sr!?Bh(@Ejs9qPADhSGIwGt#v&@>J`@JL-qW@C6LvP6Lx z!Ek~ICkdh~ghQx;$@;=IvK_t=M-ssx5g!qeU9}Ko zG@&1ih!n#^N)&=fxJKfDs}_XhCGikEHy$t6NCCARo+Cg21fgpLu1ZZ zMjcWdsppJ-8V44O88;YdKW+uA4+lOyYotgM&H1=ED0e6#vmp*BP!L=vKpZQ_lB~sQ zhJh9uHvnM7Sv||*W&r%Gk)%y}pFa-bUP*weWCQV8DNsCw;vo)c&|7fc%$sn79;(Bl zXDOVtS`9`MPtiUKs8Bq|WL-DIvnv0$$A%VvS63 zm29X2!0s_B*D<^B15%(_pU+5{Ot{GmRbU{29%p?}6h^CFPg+d89&nb4=#j8rjl6sVe?d`rS=yV>-wrQYNxpmXo$8efx$5Y65RPVw1!WNgnU$`5ry;xA=R;$%?Dn{l z|CN%Ss3Fd-EqVl+o^?BOi(?;N`k-rO0+sscdkcDRePxTh?VIf_34e0z9^8k0*|>H0 zU|)4h9Oez+nd@C zCp63x)*~;zbl37!WQRtBBqTI6ASjB!;ZJ!RZ2enPleNEh88Tc_b*VP_-v!u5Eomu~ PQli_n%6agv`x^fb1g{X# literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/opensb/shaders/optionname.png b/assets/opensb/interface/opensb/shaders/optionname.png new file mode 100644 index 0000000000000000000000000000000000000000..f7c45002b58b96fe8debb76af4a9e10e8d11992e GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^A3$slHXu1Y@^L7T>hW}O45_&F_SQyDCPxw1i!T#4 zajM-6J9FmE0k@nZ4uUSJjv_8P7t*tscU3iAKDhtl@1;{dJy;(5NaS_IQ6n+Ke#yzt zPq6kh{0#fP b.name end +local function alphabeticalNameSortLesser(a, b) return a.name < b.name end +local sortedGroups = {} +local groups = {} + +local widgetsToGroups = {} +local allSettings = {} + +local function addGroupToList(data) + local name = widget.addListItem(GROUP_LIST_WIDGET) + widget.setText(fmt("%s.%s.button", GROUP_LIST_WIDGET, name), data.friendlyName) + log("Added group ^cyan;%s^reset; to list", data.friendlyName) + return name +end + +local function parseGroups() + for name, data in next, renderer.postProcessGroups() do + if not data.hidden then + if not data.friendlyName then data.friendlyName = name end + data.groupId = name + data.name = data.friendlyName + groups[data.groupId] = data + end + end + + for groupId, data in pairs(groups) do + sortedGroups[#sortedGroups + 1] = data + end + table.sort(sortedGroups, alphabeticalNameSortLesser) + for i = 1, #sortedGroups do + local data = sortedGroups[i] + data.index = i + local name = addGroupToList(data) + data.widget = name + widgetsToGroups[name] = data + end + if sortedGroups[1] then + local first = sortedGroups[1].widget + widget.setListSelected(GROUP_LIST_WIDGET, first) + selectGroup(first) + end +end + +local activeGroup + +local function addOptionGroup(data, i, added) + local y = (i - 1) * -14 + local bg = { + type = "image", + file = PATH .. "groupname.png", + position = {-12, y} + } + local name = "group_" .. i + widget.addChild(BINDS_WIDGET, bg, name) + added[#added + 1] = name + local label = { + type = "label", + value = data.name, + wrapWidth = 120, + fontSize = 8, + hAnchor = "mid", + vAnchor = "mid", + position = {120, 6} + } + widget.addChild(fmt("%s.%s", BINDS_WIDGET, name), label, "text") +end + +local function addOption(data, i, added) + local y = (i - 1) * -14 + local bg = { + type = "image", + file = PATH .. "optionname.png", + position = {-12, y} + } + local name = "label_" .. i + widget.addChild(OPTIONS_WIDGET, bg, name) + added[#added + 1] = name + local label = { + type = "label", + value = data.name, + wrapWidth = 120, + fontSize = 8, + hAnchor = "mid", + vAnchor = "mid", + position = {62, 6} + } + widget.addChild(fmt("%s.%s", OPTIONS_WIDGET, name), label, "text") + -- todo: finish this +end + +local function addEnabled(groupname, i, added) + local y = (i - 1) * -14 + local bg = { + type = "image", + file = PATH .. "optionname.png", + position = {-12, y} + } + local name = "label_" .. i + widget.addChild(OPTIONS_WIDGET, bg, name) + added[#added + 1] = name + local label = { + type = "label", + value = "Enabled", + wrapWidth = 120, + fontSize = 8, + hAnchor = "mid", + vAnchor = "mid", + position = {62, 6} + } + widget.addChild(fmt("%s.%s", OPTIONS_WIDGET, name), label, "text") + local checkbox = { + type = "button", + callback = "toggleGroupEnabled", + position = {165, y + 2}, + pressedOffset = {0, 0}, + base = "/interface/optionsmenu/checkboxnocheck.png", + hover = "/interface/optionsmenu/checkboxnocheckhover.png", + baseImageChecked = "/interface/optionsmenu/checkboxcheck.png", + hoverImageChecked = "/interface/optionsmenu/checkboxcheckhover.png", + checkable = true, + checked = renderer.postProcessGroupEnabled(groupname) + } + name = "check_"..groupname + added[#added + 1] = name + widget.addChild(OPTIONS_WIDGET, checkbox, name) +end + +function toggleGroupEnabled(checkbox, cdata) + renderer.setPostProcessGroupEnabled(activeGroup, widget.getChecked(fmt("%s.%s",OPTIONS_WIDGET,checkbox)), true) +end + +function selectGroup() + local selected = widget.getListSelected(GROUP_LIST_WIDGET) + local group = widgetsToGroups[selected] + local dataFromPrev = widget.getData(OPTIONS_WIDGET) + if dataFromPrev then + for i, v in pairs(dataFromPrev) do + widget.removeChild(OPTIONS_WIDGET, v) + end + end + widgetsToOptions = {} + + activeGroup = group.groupId + + local bannerOptions = widget.bindCanvas("banner") + bannerOptions:clear() + + local bannerName = tostring(group.bannerName or group.name or group.groupId) + bannerOptions:drawText(bannerName, {position = {127, 13}, horizontalAnchor = "mid", verticalAnchor = "mid"}, 16) + + local added = {} + local index = 0 + addEnabled(group.groupId,index,added) + + --[[ + local categories = group.categories or {} + if not categories.unsorted then + categories.unsorted = {name = "Unsorted"} + end + + local sortedCategories = {} + for categoryId, data in pairs(categories) do + data.name = tostring(data.name or categoryId) + data.sortedOptions = {} + sortedCategories[#sortedCategories + 1] = data + end + + table.sort(sortedCategories, alphabeticalNameSortLesser) + + for categoryId, data in pairs(categories) do + table.sort(data.sortedOptions, alphabeticalNameSortLesser) + end + + local onlyUnsorted = not sortedGroups[2] and sortedGroups[1] == categories.unsorted + + for iA = 1, #sortedCategories do + local category = sortedCategories[iA] + local optionsCount = #category.sortedOptions + if optionsCount > 0 then + if not onlyUnsorted then + index = index + 1 + addOptionCategory(category, index, added) + end + for iB = 1, optionsCount do + index = index + 1 + addOption(category.sortedOptions[iB], index, added) + end + end + end]] + + widget.setData(OPTIONS_WIDGET, added) +end + + +local function initCallbacks() + widget.registerMemberCallback(GROUP_LIST_WIDGET, "selectGroup", selectGroup) +end + +function init() + --log = chat and chat.addMessage or sb.logInfo + + widget.clearListItems(GROUP_LIST_WIDGET) + initCallbacks() + parseGroups() + + script.setUpdateDelta(1) +end From 1f5606b4d5f876774cb24a083361dd497c0d2cbb Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:41:05 -0800 Subject: [PATCH 18/21] Update StarClientApplication.cpp --- source/client/StarClientApplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 81b217f..09ebf0c 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -611,7 +611,7 @@ void ClientApplication::changeState(MainAppState newState) { }; m_mainMixer->setUniverseClient(m_universeClient); - m_titleScreen = make_shared(m_playerStorage, m_mainMixer->mixer()); + m_titleScreen = make_shared(m_playerStorage, m_mainMixer->mixer(), m_universeClient); if (auto renderer = Application::renderer()) m_titleScreen->renderInit(renderer); } From 93839a20323328e0acee060e78d77ee0b504774d Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:41:35 -0800 Subject: [PATCH 19/21] Update StarTitleScreen.hpp --- source/frontend/StarTitleScreen.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); From ea21eb55d765cd9479debd5831dbc593b88af50d Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:41:54 -0800 Subject: [PATCH 20/21] Update StarTitleScreen.cpp --- source/frontend/StarTitleScreen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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(&m_paneManager); +void TitleScreen::initOptionsMenu(UniverseClientPtr client) { + auto optionsMenu = make_shared(&m_paneManager,client); optionsMenu->setAnchor(PaneAnchor::Center); optionsMenu->lockPosition(); From 300b8f2dbae631fdddeafaee683f450418e5cc57 Mon Sep 17 00:00:00 2001 From: Bottinator22 <59987380+Bottinator22@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:45:26 -0800 Subject: [PATCH 21/21] Update build.yml --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 925c2a3..8434c80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,14 @@ name: Build on: workflow_dispatch: + push: + branches: + - "*" + + pull_request: + branches: + - "*" + jobs: build_windows: name: Build OpenStarbound Windows x64