mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Split the backgroundPadding property into backgroundHorizontalPadding and backgroundVerticalPadding properties for the helpsystem, systemstatus and clock elements
This commit is contained in:
parent
668d4626b5
commit
8feda8d372
|
@ -575,7 +575,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"backgroundColorEnd", COLOR},
|
{"backgroundColorEnd", COLOR},
|
||||||
{"backgroundGradientType", STRING},
|
{"backgroundGradientType", STRING},
|
||||||
{"backgroundPadding", NORMALIZED_PAIR},
|
{"backgroundHorizontalPadding", NORMALIZED_PAIR},
|
||||||
|
{"backgroundVerticalPadding", NORMALIZED_PAIR},
|
||||||
{"backgroundCornerRadius", FLOAT},
|
{"backgroundCornerRadius", FLOAT},
|
||||||
{"opacity", FLOAT},
|
{"opacity", FLOAT},
|
||||||
{"opacityDimmed", FLOAT},
|
{"opacityDimmed", FLOAT},
|
||||||
|
@ -593,7 +594,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"backgroundColorEnd", COLOR},
|
{"backgroundColorEnd", COLOR},
|
||||||
{"backgroundGradientType", STRING},
|
{"backgroundGradientType", STRING},
|
||||||
{"backgroundPadding", NORMALIZED_PAIR},
|
{"backgroundHorizontalPadding", NORMALIZED_PAIR},
|
||||||
|
{"backgroundVerticalPadding", NORMALIZED_PAIR},
|
||||||
{"backgroundCornerRadius", FLOAT},
|
{"backgroundCornerRadius", FLOAT},
|
||||||
{"entries", STRING},
|
{"entries", STRING},
|
||||||
{"entrySpacing", FLOAT},
|
{"entrySpacing", FLOAT},
|
||||||
|
@ -614,7 +616,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"backgroundColorEnd", COLOR},
|
{"backgroundColorEnd", COLOR},
|
||||||
{"backgroundGradientType", STRING},
|
{"backgroundGradientType", STRING},
|
||||||
{"backgroundPadding", NORMALIZED_PAIR},
|
{"backgroundHorizontalPadding", NORMALIZED_PAIR},
|
||||||
|
{"backgroundVerticalPadding", NORMALIZED_PAIR},
|
||||||
{"backgroundCornerRadius", FLOAT},
|
{"backgroundCornerRadius", FLOAT},
|
||||||
{"format", STRING},
|
{"format", STRING},
|
||||||
{"opacity", FLOAT}}},
|
{"opacity", FLOAT}}},
|
||||||
|
|
|
@ -20,7 +20,8 @@ DateTimeComponent::DateTimeComponent()
|
||||||
, mClockAccumulator {0}
|
, mClockAccumulator {0}
|
||||||
, mClockMode {false}
|
, mClockMode {false}
|
||||||
, mDisplayRelative {false}
|
, mDisplayRelative {false}
|
||||||
, mBackgroundPadding {0.0f, 0.0f}
|
, mBackgroundHorizontalPadding {0.0f, 0.0f}
|
||||||
|
, mBackgroundVerticalPadding {0.0f, 0.0f}
|
||||||
, mClockBgColor {0x00000000}
|
, mClockBgColor {0x00000000}
|
||||||
, mClockBgColorEnd {0x00000000}
|
, mClockBgColorEnd {0x00000000}
|
||||||
, mClockColorGradientHorizontal {true}
|
, mClockColorGradientHorizontal {true}
|
||||||
|
@ -42,7 +43,8 @@ DateTimeComponent::DateTimeComponent(const std::string& text,
|
||||||
, mClockAccumulator {0}
|
, mClockAccumulator {0}
|
||||||
, mClockMode {false}
|
, mClockMode {false}
|
||||||
, mDisplayRelative {false}
|
, mDisplayRelative {false}
|
||||||
, mBackgroundPadding {0.0f, 0.0f}
|
, mBackgroundHorizontalPadding {0.0f, 0.0f}
|
||||||
|
, mBackgroundVerticalPadding {0.0f, 0.0f}
|
||||||
, mClockBgColor {0x00000000}
|
, mClockBgColor {0x00000000}
|
||||||
, mClockBgColorEnd {0x00000000}
|
, mClockBgColorEnd {0x00000000}
|
||||||
, mClockColorGradientHorizontal {true}
|
, mClockColorGradientHorizontal {true}
|
||||||
|
@ -160,15 +162,16 @@ void DateTimeComponent::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
if (mClockMode && mClockBgColor != 0x00000000) {
|
if (mClockMode && mClockBgColor != 0x00000000) {
|
||||||
glm::mat4 trans {parentTrans * getTransform()};
|
glm::mat4 trans {parentTrans * getTransform()};
|
||||||
trans = glm::translate(
|
trans = glm::translate(trans, glm::vec3 {-mBackgroundHorizontalPadding.x,
|
||||||
trans, glm::vec3 {-mBackgroundPadding.x / 2.0f, -mBackgroundPadding.y / 2.0f, 0.0f});
|
-mBackgroundVerticalPadding.x, 0.0f});
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
mRenderer->drawRect(0.0f, 0.0f, mSize.x + mBackgroundPadding.x,
|
mRenderer->drawRect(
|
||||||
mSize.y + mBackgroundPadding.y, mClockBgColor, mClockBgColorEnd,
|
0.0f, 0.0f, mSize.x + mBackgroundHorizontalPadding.x + mBackgroundHorizontalPadding.y,
|
||||||
mClockColorGradientHorizontal, mThemeOpacity, 1.0f,
|
mSize.y + mBackgroundVerticalPadding.x + mBackgroundVerticalPadding.y, mClockBgColor,
|
||||||
Renderer::BlendFactor::SRC_ALPHA,
|
mClockBgColorEnd, mClockColorGradientHorizontal, mThemeOpacity, 1.0f,
|
||||||
Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA, mBackgroundCornerRadius);
|
Renderer::BlendFactor::SRC_ALPHA, Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA,
|
||||||
|
mBackgroundCornerRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the component.
|
// Render the component.
|
||||||
|
@ -288,11 +291,20 @@ void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mRenderer->getScreenWidth());
|
mRenderer->getScreenWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mClockMode && elem->has("backgroundPadding")) {
|
if (mClockMode && elem->has("backgroundHorizontalPadding")) {
|
||||||
const glm::vec2 backgroundPadding {
|
const glm::vec2 backgroundHorizontalPadding {
|
||||||
glm::clamp(elem->get<glm::vec2>("backgroundPadding"), 0.0f, 0.2f)};
|
glm::clamp(elem->get<glm::vec2>("backgroundHorizontalPadding"), 0.0f, 0.2f)};
|
||||||
mBackgroundPadding.x = backgroundPadding.x * mRenderer->getScreenWidth();
|
mBackgroundHorizontalPadding.x =
|
||||||
mBackgroundPadding.y = backgroundPadding.y * mRenderer->getScreenHeight();
|
backgroundHorizontalPadding.x * mRenderer->getScreenWidth();
|
||||||
|
mBackgroundHorizontalPadding.y =
|
||||||
|
backgroundHorizontalPadding.y * mRenderer->getScreenWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mClockMode && elem->has("backgroundVerticalPadding")) {
|
||||||
|
const glm::vec2 backgroundVerticalPadding {
|
||||||
|
glm::clamp(elem->get<glm::vec2>("backgroundVerticalPadding"), 0.0f, 0.2f)};
|
||||||
|
mBackgroundVerticalPadding.x = backgroundVerticalPadding.x * mRenderer->getScreenHeight();
|
||||||
|
mBackgroundVerticalPadding.y = backgroundVerticalPadding.y * mRenderer->getScreenHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("backgroundCornerRadius")) {
|
if (elem->has("backgroundCornerRadius")) {
|
||||||
|
|
|
@ -56,7 +56,8 @@ private:
|
||||||
std::string mFormat;
|
std::string mFormat;
|
||||||
bool mClockMode;
|
bool mClockMode;
|
||||||
bool mDisplayRelative;
|
bool mDisplayRelative;
|
||||||
glm::vec2 mBackgroundPadding;
|
glm::vec2 mBackgroundHorizontalPadding;
|
||||||
|
glm::vec2 mBackgroundVerticalPadding;
|
||||||
unsigned int mClockBgColor;
|
unsigned int mClockBgColor;
|
||||||
unsigned int mClockBgColorEnd;
|
unsigned int mClockBgColorEnd;
|
||||||
bool mClockColorGradientHorizontal;
|
bool mClockColorGradientHorizontal;
|
||||||
|
|
|
@ -33,7 +33,8 @@ HelpComponent::HelpComponent(std::shared_ptr<Font> font)
|
||||||
, mStyleIconColorDimmed {0x777777FF}
|
, mStyleIconColorDimmed {0x777777FF}
|
||||||
, mStyleBackgroundColor {0x00000000}
|
, mStyleBackgroundColor {0x00000000}
|
||||||
, mStyleBackgroundColorEnd {0x00000000}
|
, mStyleBackgroundColorEnd {0x00000000}
|
||||||
, mStyleBackgroundPadding {0.0f, 0.0f}
|
, mStyleBackgroundHorizontalPadding {0.0f, 0.0f}
|
||||||
|
, mStyleBackgroundVerticalPadding {0.0f, 0.0f}
|
||||||
, mStyleBackgroundCornerRadius {0.0f}
|
, mStyleBackgroundCornerRadius {0.0f}
|
||||||
, mStyleColorGradientHorizontal {true}
|
, mStyleColorGradientHorizontal {true}
|
||||||
, mStyleEntryLayout {EntryLayout::ICON_FIRST}
|
, mStyleEntryLayout {EntryLayout::ICON_FIRST}
|
||||||
|
@ -156,11 +157,22 @@ void HelpComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("backgroundPadding")) {
|
if (elem->has("backgroundHorizontalPadding")) {
|
||||||
const glm::vec2 backgroundPadding {
|
const glm::vec2 backgroundHorizontalPadding {
|
||||||
glm::clamp(elem->get<glm::vec2>("backgroundPadding"), 0.0f, 0.2f)};
|
glm::clamp(elem->get<glm::vec2>("backgroundHorizontalPadding"), 0.0f, 0.2f)};
|
||||||
mStyleBackgroundPadding.x = backgroundPadding.x * mRenderer->getScreenWidth();
|
mStyleBackgroundHorizontalPadding.x =
|
||||||
mStyleBackgroundPadding.y = backgroundPadding.y * mRenderer->getScreenHeight();
|
backgroundHorizontalPadding.x * mRenderer->getScreenWidth();
|
||||||
|
mStyleBackgroundHorizontalPadding.y =
|
||||||
|
backgroundHorizontalPadding.y * mRenderer->getScreenWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem->has("backgroundVerticalPadding")) {
|
||||||
|
const glm::vec2 backgroundVerticalPadding {
|
||||||
|
glm::clamp(elem->get<glm::vec2>("backgroundVerticalPadding"), 0.0f, 0.2f)};
|
||||||
|
mStyleBackgroundVerticalPadding.x =
|
||||||
|
backgroundVerticalPadding.x * mRenderer->getScreenHeight();
|
||||||
|
mStyleBackgroundVerticalPadding.y =
|
||||||
|
backgroundVerticalPadding.y * mRenderer->getScreenHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("backgroundCornerRadius")) {
|
if (elem->has("backgroundCornerRadius")) {
|
||||||
|
@ -395,16 +407,17 @@ void HelpComponent::render(const glm::mat4& parentTrans)
|
||||||
mRotationOrigin = mStyleRotationOrigin;
|
mRotationOrigin = mStyleRotationOrigin;
|
||||||
|
|
||||||
glm::mat4 trans {parentTrans * getTransform()};
|
glm::mat4 trans {parentTrans * getTransform()};
|
||||||
trans = glm::translate(trans, glm::vec3 {-mStyleBackgroundPadding.x / 2.0f,
|
trans = glm::translate(trans, glm::vec3 {-mStyleBackgroundHorizontalPadding.x,
|
||||||
-mStyleBackgroundPadding.y / 2.0f, 0.0f});
|
-mStyleBackgroundVerticalPadding.x, 0.0f});
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
mRenderer->drawRect(
|
mRenderer->drawRect(
|
||||||
0.0f, 0.0f,
|
0.0f, 0.0f,
|
||||||
mSize.x + mStyleBackgroundPadding.x -
|
mSize.x + mStyleBackgroundHorizontalPadding.x + mStyleBackgroundHorizontalPadding.y -
|
||||||
(mStyleEntrySpacing * mRenderer->getScreenWidth()),
|
(mStyleEntrySpacing * mRenderer->getScreenWidth()),
|
||||||
mSize.y + mStyleBackgroundPadding.y, mStyleBackgroundColor, mStyleBackgroundColorEnd,
|
mSize.y + mStyleBackgroundVerticalPadding.x + mStyleBackgroundVerticalPadding.y,
|
||||||
mStyleColorGradientHorizontal, mThemeOpacity, 1.0f, Renderer::BlendFactor::SRC_ALPHA,
|
mStyleBackgroundColor, mStyleBackgroundColorEnd, mStyleColorGradientHorizontal,
|
||||||
|
mThemeOpacity, 1.0f, Renderer::BlendFactor::SRC_ALPHA,
|
||||||
Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA, mStyleBackgroundCornerRadius);
|
Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA, mStyleBackgroundCornerRadius);
|
||||||
|
|
||||||
mPosition = {0.0f, 0.0f, 0.0f};
|
mPosition = {0.0f, 0.0f, 0.0f};
|
||||||
|
|
|
@ -87,7 +87,8 @@ private:
|
||||||
unsigned int mStyleIconColorDimmed;
|
unsigned int mStyleIconColorDimmed;
|
||||||
unsigned int mStyleBackgroundColor;
|
unsigned int mStyleBackgroundColor;
|
||||||
unsigned int mStyleBackgroundColorEnd;
|
unsigned int mStyleBackgroundColorEnd;
|
||||||
glm::vec2 mStyleBackgroundPadding;
|
glm::vec2 mStyleBackgroundHorizontalPadding;
|
||||||
|
glm::vec2 mStyleBackgroundVerticalPadding;
|
||||||
float mStyleBackgroundCornerRadius;
|
float mStyleBackgroundCornerRadius;
|
||||||
bool mStyleColorGradientHorizontal;
|
bool mStyleColorGradientHorizontal;
|
||||||
EntryLayout mStyleEntryLayout;
|
EntryLayout mStyleEntryLayout;
|
||||||
|
|
|
@ -30,7 +30,8 @@ SystemStatusComponent::SystemStatusComponent()
|
||||||
, mBackgroundColorEnd {0x00000000}
|
, mBackgroundColorEnd {0x00000000}
|
||||||
, mAccumulator {0}
|
, mAccumulator {0}
|
||||||
, mAccumulatorAndroid {0}
|
, mAccumulatorAndroid {0}
|
||||||
, mBackgroundPadding {0.0f, 0.0f}
|
, mBackgroundHorizontalPadding {0.0f, 0.0f}
|
||||||
|
, mBackgroundVerticalPadding {0.0f, 0.0f}
|
||||||
, mBackgroundCornerRadius {0.0f}
|
, mBackgroundCornerRadius {0.0f}
|
||||||
, mColorGradientHorizontal {true}
|
, mColorGradientHorizontal {true}
|
||||||
, mEntrySpacing {0.005f * mRenderer->getScreenWidth()}
|
, mEntrySpacing {0.005f * mRenderer->getScreenWidth()}
|
||||||
|
@ -255,11 +256,22 @@ void SystemStatusComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("backgroundPadding")) {
|
if (elem->has("backgroundHorizontalPadding")) {
|
||||||
const glm::vec2 backgroundPadding {
|
const glm::vec2 backgroundHorizontalPadding {
|
||||||
glm::clamp(elem->get<glm::vec2>("backgroundPadding"), 0.0f, 0.2f)};
|
glm::clamp(elem->get<glm::vec2>("backgroundHorizontalPadding"), 0.0f, 0.2f)};
|
||||||
mBackgroundPadding.x = backgroundPadding.x * mRenderer->getScreenWidth();
|
mBackgroundHorizontalPadding.x =
|
||||||
mBackgroundPadding.y = backgroundPadding.y * mRenderer->getScreenHeight();
|
backgroundHorizontalPadding.x * mRenderer->getScreenWidth();
|
||||||
|
mBackgroundHorizontalPadding.y =
|
||||||
|
backgroundHorizontalPadding.y * mRenderer->getScreenWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem->has("backgroundVerticalPadding")) {
|
||||||
|
const glm::vec2 backgroundVerticalPadding {
|
||||||
|
glm::clamp(elem->get<glm::vec2>("backgroundVerticalPadding"), 0.0f, 0.2f)};
|
||||||
|
mBackgroundVerticalPadding.x =
|
||||||
|
backgroundVerticalPadding.x * mRenderer->getScreenHeight();
|
||||||
|
mBackgroundVerticalPadding.y =
|
||||||
|
backgroundVerticalPadding.y * mRenderer->getScreenHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("backgroundCornerRadius")) {
|
if (elem->has("backgroundCornerRadius")) {
|
||||||
|
@ -432,12 +444,14 @@ void SystemStatusComponent::render(const glm::mat4& parentTrans)
|
||||||
mRotationOrigin = mRotationOrigin;
|
mRotationOrigin = mRotationOrigin;
|
||||||
|
|
||||||
glm::mat4 trans {parentTrans * getTransform()};
|
glm::mat4 trans {parentTrans * getTransform()};
|
||||||
trans = glm::translate(trans, glm::vec3 {-mBackgroundPadding.x / 2.0f,
|
trans = glm::translate(trans, glm::vec3 {-mBackgroundHorizontalPadding.x,
|
||||||
-mBackgroundPadding.y / 2.0f, 0.0f});
|
-mBackgroundVerticalPadding.x, 0.0f});
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
mRenderer->drawRect(
|
mRenderer->drawRect(
|
||||||
0.0f, 0.0f, mSize.x + mBackgroundPadding.x, mSize.y + mBackgroundPadding.y,
|
0.0f, 0.0f,
|
||||||
|
mSize.x + mBackgroundHorizontalPadding.x + mBackgroundHorizontalPadding.y,
|
||||||
|
mSize.y + mBackgroundVerticalPadding.x + mBackgroundVerticalPadding.y,
|
||||||
mBackgroundColor, mBackgroundColorEnd, mColorGradientHorizontal, mThemeOpacity,
|
mBackgroundColor, mBackgroundColorEnd, mColorGradientHorizontal, mThemeOpacity,
|
||||||
1.0f, Renderer::BlendFactor::SRC_ALPHA, Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA,
|
1.0f, Renderer::BlendFactor::SRC_ALPHA, Renderer::BlendFactor::ONE_MINUS_SRC_ALPHA,
|
||||||
mBackgroundCornerRadius);
|
mBackgroundCornerRadius);
|
||||||
|
|
|
@ -59,7 +59,8 @@ private:
|
||||||
unsigned int mBackgroundColorEnd;
|
unsigned int mBackgroundColorEnd;
|
||||||
int mAccumulator;
|
int mAccumulator;
|
||||||
int mAccumulatorAndroid;
|
int mAccumulatorAndroid;
|
||||||
glm::vec2 mBackgroundPadding;
|
glm::vec2 mBackgroundHorizontalPadding;
|
||||||
|
glm::vec2 mBackgroundVerticalPadding;
|
||||||
float mBackgroundCornerRadius;
|
float mBackgroundCornerRadius;
|
||||||
bool mColorGradientHorizontal;
|
bool mColorGradientHorizontal;
|
||||||
float mEntrySpacing;
|
float mEntrySpacing;
|
||||||
|
|
Loading…
Reference in a new issue