This commit is contained in:
maybegreat48 committed 2025-06-20 18:27:56 -04:00
1 parent be762b761a
commit b50c32cf7b
3 files changed
+18 -61

No files matched your search

+18 -2
View File
@@ -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<std::pair<int, const char*>> 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>&& 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<UITheme>(selectedIndex))
@@ -1,52 +0,0 @@
#include "StyleSelector.hpp"
#include "core/commands/ListCommand.hpp"
#include "core/frontend/manager/UIManager.hpp"
namespace YimMenu
{
static const std::vector<std::pair<int, const char*>> 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;
}
@@ -1,7 +0,0 @@
#pragma once
namespace YimMenu
{
class ListCommand; // Forward declare base class
extern ListCommand& g_StyleSelector; // Expose the instance as base
}