Added support for a 'none' value to the helpsystem element scope property

This commit is contained in:
Leon Styhre 2025-02-05 20:45:27 +01:00
parent 4a002d4fb3
commit c1cfc02942
4 changed files with 13 additions and 1 deletions

View file

@ -352,6 +352,8 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
else if (element.second.type == "helpsystem") { else if (element.second.type == "helpsystem") {
mHelpComponents.emplace_back(std::make_unique<HelpComponent>()); mHelpComponents.emplace_back(std::make_unique<HelpComponent>());
mHelpComponents.back()->applyTheme(theme, "gamelist", element.first, ALL); mHelpComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
if (mHelpComponents.back()->getHelpComponentScope() == HelpComponentScope::NONE)
mHelpComponents.pop_back();
} }
} }
} }

View file

@ -726,6 +726,10 @@ void SystemView::populate()
elements.helpComponents.emplace_back(std::make_unique<HelpComponent>()); elements.helpComponents.emplace_back(std::make_unique<HelpComponent>());
elements.helpComponents.back()->applyTheme(theme, "system", element.first, elements.helpComponents.back()->applyTheme(theme, "system", element.first,
ThemeFlags::ALL); ThemeFlags::ALL);
if (elements.helpComponents.back()->getHelpComponentScope() ==
HelpComponentScope::NONE) {
elements.helpComponents.pop_back();
}
} }
} }
} }

View file

@ -68,7 +68,8 @@ enum class Stationary {
enum class HelpComponentScope { enum class HelpComponentScope {
SHARED, SHARED,
VIEW, VIEW,
MENU MENU,
NONE
}; };
class GuiComponent class GuiComponent

View file

@ -270,6 +270,11 @@ void HelpComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (!elem) if (!elem)
return; return;
if (elem->has("scope") && elem->get<std::string>("scope") == "none") {
mHelpComponentScope = HelpComponentScope::NONE;
return;
}
if (elem->has("pos")) if (elem->has("pos"))
mStylePosition = elem->get<glm::vec2>("pos") * mStylePosition = elem->get<glm::vec2>("pos") *
glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()}; glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()};