diff --git a/es-core/src/HelpStyle.cpp b/es-core/src/HelpStyle.cpp index e7d1c196a..885e59f7c 100644 --- a/es-core/src/HelpStyle.cpp +++ b/es-core/src/HelpStyle.cpp @@ -15,13 +15,12 @@ HelpStyle::HelpStyle() : position {Renderer::getScreenWidth() * 0.012f, Renderer::getScreenHeight() * 0.9515f} , origin {glm::vec2 {}} - , horizontalAlignment {"left"} , textColor {0x777777FF} , textColorDimmed {0x777777FF} , iconColor {0x777777FF} , iconColorDimmed {0x777777FF} - , entrySpacing {16.0f} - , iconTextSpacing {8.0f} + , entrySpacing {0.00833f} + , iconTextSpacing {0.00416f} , opacity {1.0f} , letterCase {"uppercase"} { @@ -38,33 +37,12 @@ void HelpStyle::applyTheme(const std::shared_ptr& theme, const std::s if (!elem) return; - if (elem->has("horizontalAlignment")) { - horizontalAlignment = elem->get("horizontalAlignment"); - if (horizontalAlignment != "left" && horizontalAlignment != "center" && - horizontalAlignment != "right") { - LOG(LogWarning) << "HelpSystem: Invalid theme configuration, property " - " defined as \"" - << horizontalAlignment << "\""; - horizontalAlignment = "left"; - } - } - - if (horizontalAlignment == "center") - position.x = 0.0f; - if (elem->has("pos")) position = elem->get("pos") * glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()}; - if (elem->has("origin")) { - if (theme->isLegacyTheme()) { - origin = elem->get("origin"); - } - else { - LOG(LogWarning) << "HelpSystem: Invalid theme configuration, property " - " not allowed for the helpsystem component"; - } - } + if (elem->has("origin")) + origin = elem->get("origin"); if (elem->has("textColor")) textColor = elem->get("textColor"); @@ -86,10 +64,10 @@ void HelpStyle::applyTheme(const std::shared_ptr& theme, const std::s font = Font::getFromTheme(elem, ThemeFlags::ALL, font); if (elem->has("entrySpacing")) - entrySpacing = elem->get("entrySpacing"); + entrySpacing = glm::clamp(elem->get("entrySpacing"), 0.0f, 0.04f); if (elem->has("iconTextSpacing")) - iconTextSpacing = elem->get("iconTextSpacing"); + iconTextSpacing = glm::clamp(elem->get("iconTextSpacing"), 0.0f, 0.04f); if (elem->has("letterCase")) letterCase = elem->get("letterCase"); diff --git a/es-core/src/HelpStyle.h b/es-core/src/HelpStyle.h index 693a3e36a..d7eb5bf03 100644 --- a/es-core/src/HelpStyle.h +++ b/es-core/src/HelpStyle.h @@ -20,7 +20,6 @@ class ThemeData; struct HelpStyle { glm::vec2 position; glm::vec2 origin; - std::string horizontalAlignment; unsigned int textColor; unsigned int textColorDimmed; unsigned int iconColor; diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 95ec529ae..1481661af 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -292,8 +292,7 @@ std::map> {"gameCount", UNSIGNED_INTEGER}}}, {"helpsystem", {{"pos", NORMALIZED_PAIR}, - {"origin", NORMALIZED_PAIR}, // For backward compatibility with legacy themes. - {"horizontalAlignment", STRING}, + {"origin", NORMALIZED_PAIR}, {"textColor", COLOR}, {"textColorDimmed", COLOR}, {"iconColor", COLOR}, diff --git a/es-core/src/components/HelpComponent.cpp b/es-core/src/components/HelpComponent.cpp index 35111c250..85736654f 100644 --- a/es-core/src/components/HelpComponent.cpp +++ b/es-core/src/components/HelpComponent.cpp @@ -237,9 +237,9 @@ void HelpComponent::updateGrid() lbl->setOpacity(mStyle.opacity); labels.push_back(lbl); - width += - icon->getSize().x + lbl->getSize().x + - ((mStyle.iconTextSpacing + mStyle.entrySpacing) * mRenderer->getScreenWidthModifier()); + width += icon->getSize().x + lbl->getSize().x + + ((mStyle.iconTextSpacing * mRenderer->getScreenWidth() + + mStyle.entrySpacing * mRenderer->getScreenWidth())); } mGrid->setSize(width, height); @@ -247,27 +247,15 @@ void HelpComponent::updateGrid() for (unsigned int i = 0; i < icons.size(); ++i) { const int col = i * 4; mGrid->setColWidthPerc(col, icons.at(i)->getSize().x / width); - mGrid->setColWidthPerc( - col + 1, (mStyle.iconTextSpacing * mRenderer->getScreenWidthModifier()) / width); + mGrid->setColWidthPerc(col + 1, + (mStyle.iconTextSpacing * mRenderer->getScreenWidth()) / width); mGrid->setColWidthPerc(col + 2, labels.at(i)->getSize().x / width); mGrid->setEntry(icons.at(i), glm::ivec2 {col, 0}, false, false); mGrid->setEntry(labels.at(i), glm::ivec2 {col + 2, 0}, false, false); } - if (mStyle.horizontalAlignment == "right") { - mGrid->setPosition({mRenderer->getScreenWidth() - mGrid->getSize().x - mStyle.position.x + - mStyle.iconTextSpacing + mStyle.entrySpacing, - mStyle.position.y, 0.0f}); - } - else if (mStyle.horizontalAlignment == "center") { - mGrid->setPosition({(mRenderer->getScreenWidth() / 2.0f) - (mGrid->getSize().x / 2.0f) - - mStyle.position.x + mStyle.iconTextSpacing, - mStyle.position.y, 0.0f}); - } - else { - mGrid->setPosition({mStyle.position.x, mStyle.position.y, 0.0f}); - } + mGrid->setPosition({mStyle.position.x, mStyle.position.y, 0.0f}); mGrid->setOrigin(mStyle.origin); } diff --git a/themes/rbsimple-DE/theme_engine_test.xml b/themes/rbsimple-DE/theme_engine_test.xml index dea798635..b43e03d5e 100644 --- a/themes/rbsimple-DE/theme_engine_test.xml +++ b/themes/rbsimple-DE/theme_engine_test.xml @@ -227,8 +227,8 @@ - 0.020 0.954 - right + 0.9885 0.954 + 1 0