mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Changed SystemStatusComponent to use a height property instead of a size property
This commit is contained in:
parent
931e4e1fea
commit
ad79cad5f0
|
|
@ -576,7 +576,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"customButtonIcon", PATH}}},
|
{"customButtonIcon", PATH}}},
|
||||||
{"systemstatus",
|
{"systemstatus",
|
||||||
{{"pos", NORMALIZED_PAIR},
|
{{"pos", NORMALIZED_PAIR},
|
||||||
{"size", NORMALIZED_PAIR},
|
{"height", FLOAT},
|
||||||
{"origin", NORMALIZED_PAIR},
|
{"origin", NORMALIZED_PAIR},
|
||||||
{"fontPath", PATH},
|
{"fontPath", PATH},
|
||||||
{"textRelativeScale", FLOAT},
|
{"textRelativeScale", FLOAT},
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,10 @@ void SystemStatusComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
unsigned int properties)
|
unsigned int properties)
|
||||||
{
|
{
|
||||||
// Apply default settings as the theme may not define any configuration.
|
// Apply default settings as the theme may not define any configuration.
|
||||||
const glm::vec2 scale {glm::vec2 {Renderer::getScreenWidth(), Renderer::getScreenHeight()}};
|
const float scale {mRenderer->getIsVerticalOrientation() ? mRenderer->getScreenWidth() :
|
||||||
mPosition = glm::vec3 {0.982f * scale.x, 0.016f * scale.y, 0.0f};
|
mRenderer->getScreenHeight()};
|
||||||
mSize = glm::vec2 {0.0f, 0.035f} * scale;
|
mPosition = glm::vec3 {0.982f * mRenderer->getScreenWidth(),
|
||||||
|
0.016f * mRenderer->getScreenHeight(), 0.0f};
|
||||||
mOrigin = glm::vec2 {1.0f, 0.0f};
|
mOrigin = glm::vec2 {1.0f, 0.0f};
|
||||||
mColor = 0xFFFFFFFF;
|
mColor = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
|
@ -178,17 +179,18 @@ void SystemStatusComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
|
||||||
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "systemstatus")};
|
const ThemeData::ThemeElement* elem {theme->getElement(view, element, "systemstatus")};
|
||||||
|
|
||||||
|
mSize = glm::vec2 {0.0f, std::round(0.035f * scale)};
|
||||||
float textRelativeScale {0.9f};
|
float textRelativeScale {0.9f};
|
||||||
|
|
||||||
if (!elem) {
|
if (!elem) {
|
||||||
mSize = glm::round(mSize);
|
|
||||||
mFont = {Font::get(mSize.y * textRelativeScale, FONT_PATH_LIGHT)};
|
mFont = {Font::get(mSize.y * textRelativeScale, FONT_PATH_LIGHT)};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSize.x = 0.0f;
|
if (elem->has("height")) {
|
||||||
mSize.y = glm::clamp(mSize.y, 0.01f * scale.y, 0.5f * scale.y);
|
mSize.y =
|
||||||
mSize = glm::round(mSize);
|
std::round(glm::clamp(elem->get<float>("height") * scale, 0.01f * scale, 0.5f * scale));
|
||||||
|
}
|
||||||
|
|
||||||
if (elem->has("textRelativeScale"))
|
if (elem->has("textRelativeScale"))
|
||||||
textRelativeScale = glm::clamp(elem->get<float>("textRelativeScale"), 0.5f, 1.0f);
|
textRelativeScale = glm::clamp(elem->get<float>("textRelativeScale"), 0.5f, 1.0f);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue