diff --git a/src/core/frontend/manager/UIManager.cpp b/src/core/frontend/manager/UIManager.cpp index 4dfa187..22ad0d6 100644 --- a/src/core/frontend/manager/UIManager.cpp +++ b/src/core/frontend/manager/UIManager.cpp @@ -1,9 +1,25 @@ #include "UIManager.hpp" #include "game/pointers/Pointers.hpp" #include "game/frontend/Menu.hpp" -#include "game/frontend/submenus/Settings/StyleSelector.hpp" #include "core/commands/ListCommand.hpp" +namespace YimMenu::Features +{ + static const std::vector> g_StyleOptions = { + {0, "Classic"}, + {1, "Modern"}, + {2, "ModernV"}, + }; + + // Expose as global reference so other code can use it + static ListCommand _StyleSelector{ + "styleselector", + "UI Style", + "Choose the UI style", + g_StyleOptions, + 0}; +} + namespace YimMenu { void UIManager::AddSubmenuImpl(const std::shared_ptr&& submenu) @@ -21,7 +37,7 @@ namespace YimMenu void UIManager::DrawImpl() { - int selectedIndex = g_StyleSelector.GetState(); + int selectedIndex = Features::_StyleSelector.GetState(); // Render the selected theme based on the index, append when adding new themes switch (static_cast(selectedIndex)) diff --git a/src/game/frontend/submenus/Settings/StyleSelector.cpp b/src/game/frontend/submenus/Settings/StyleSelector.cpp deleted file mode 100644 index 6934892..0000000 --- a/src/game/frontend/submenus/Settings/StyleSelector.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "StyleSelector.hpp" -#include "core/commands/ListCommand.hpp" -#include "core/frontend/manager/UIManager.hpp" - -namespace YimMenu -{ - static const std::vector> g_StyleOptions = { - {0, "Classic"}, - {1, "Modern"}, - {2, "ModernV"}, - }; - - class StyleSelector : public ListCommand - { - public: - using ListCommand::ListCommand; - - void OnChange() override - { - int selectedIndex = GetState(); - - UITheme selectedTheme = UITheme::Classic; // Default Theme - - // Set the selected theme based on the index, append when adding new themes - switch (selectedIndex) - { - case 0: - selectedTheme = UITheme::Classic; - break; - case 1: - selectedTheme = UITheme::Modern; - break; - case 2: - selectedTheme = UITheme::ModernV; - break; - default: - selectedTheme = UITheme::Classic; - break; - } - } - }; - - // Expose as global reference so other code can use it - static StyleSelector g_InternalStyleSelector{ - "styleselector", - "UI Style", - "Choose the UI style", - g_StyleOptions, - 0}; - - ListCommand& g_StyleSelector = g_InternalStyleSelector; -} diff --git a/src/game/frontend/submenus/Settings/StyleSelector.hpp b/src/game/frontend/submenus/Settings/StyleSelector.hpp deleted file mode 100644 index 1dde910..0000000 --- a/src/game/frontend/submenus/Settings/StyleSelector.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -namespace YimMenu -{ - class ListCommand; // Forward declare base class - extern ListCommand& g_StyleSelector; // Expose the instance as base -} \ No newline at end of file