diff --git a/src/mods/LuaLoader.cpp b/src/mods/LuaLoader.cpp index 5aad714a..30ef9980 100644 --- a/src/mods/LuaLoader.cpp +++ b/src/mods/LuaLoader.cpp @@ -82,10 +82,8 @@ void LuaLoader::on_frame() { } } -void LuaLoader::on_draw_ui() { - ImGui::SetNextItemOpen(false, ImGuiCond_::ImGuiCond_Once); - - if (ImGui::CollapsingHeader(get_name().data())) { +void LuaLoader::on_draw_sidebar_entry(std::string_view in_entry) { + if (in_entry == "Main") { if (ImGui::Button("Run script")) { OPENFILENAME ofn{}; char file[260]{}; @@ -201,9 +199,12 @@ void LuaLoader::on_draw_ui() { } else { ImGui::Text("No scripts loaded."); } + + ImGui::TreePop(); } - if (ImGui::CollapsingHeader("Script Generated UI")) { + + if (in_entry == "Script UI") { std::scoped_lock _{m_access_mutex}; if (m_states.empty()) { @@ -213,6 +214,8 @@ void LuaLoader::on_draw_ui() { for (auto& state : m_states) { state->on_draw_ui(); } + + ImGui::TreePop(); } } diff --git a/src/mods/LuaLoader.hpp b/src/mods/LuaLoader.hpp index c938964a..b7ad5704 100644 --- a/src/mods/LuaLoader.hpp +++ b/src/mods/LuaLoader.hpp @@ -21,7 +21,15 @@ class LuaLoader : public Mod { std::string_view get_name() const override { return "LuaLoader"; } bool is_advanced_mod() const override { return true; } std::optional on_initialize_d3d_thread() override; - void on_draw_ui() override; + + std::vector get_sidebar_entries() override { + return { + {"Main", true}, + {"Script UI", true} + }; + } + + void on_draw_sidebar_entry(std::string_view in_entry); void on_frame() override; void on_config_load(const utility::Config& cfg, bool set_defaults) override;