mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Added a 'textBackgroundCornerRadius' property to the carousel element
This commit is contained in:
parent
3baf505351
commit
8c9d9d51fc
|
@ -186,6 +186,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"gradientType", STRING},
|
{"gradientType", STRING},
|
||||||
{"text", STRING},
|
{"text", STRING},
|
||||||
{"textRelativeScale", FLOAT},
|
{"textRelativeScale", FLOAT},
|
||||||
|
{"textBackgroundCornerRadius", FLOAT},
|
||||||
{"textColor", COLOR},
|
{"textColor", COLOR},
|
||||||
{"textBackgroundColor", COLOR},
|
{"textBackgroundColor", COLOR},
|
||||||
{"textSelectedColor", COLOR},
|
{"textSelectedColor", COLOR},
|
||||||
|
|
|
@ -198,6 +198,7 @@ private:
|
||||||
unsigned int mCarouselColorEnd;
|
unsigned int mCarouselColorEnd;
|
||||||
bool mColorGradientHorizontal;
|
bool mColorGradientHorizontal;
|
||||||
float mTextRelativeScale;
|
float mTextRelativeScale;
|
||||||
|
float mTextBackgroundCornerRadius;
|
||||||
unsigned int mTextColor;
|
unsigned int mTextColor;
|
||||||
unsigned int mTextBackgroundColor;
|
unsigned int mTextBackgroundColor;
|
||||||
unsigned int mTextSelectedColor;
|
unsigned int mTextSelectedColor;
|
||||||
|
@ -276,6 +277,7 @@ CarouselComponent<T>::CarouselComponent()
|
||||||
, mCarouselColorEnd {0}
|
, mCarouselColorEnd {0}
|
||||||
, mColorGradientHorizontal {true}
|
, mColorGradientHorizontal {true}
|
||||||
, mTextRelativeScale {1.0f}
|
, mTextRelativeScale {1.0f}
|
||||||
|
, mTextBackgroundCornerRadius {0.0f}
|
||||||
, mTextColor {0x000000FF}
|
, mTextColor {0x000000FF}
|
||||||
, mTextBackgroundColor {0xFFFFFF00}
|
, mTextBackgroundColor {0xFFFFFF00}
|
||||||
, mTextSelectedColor {0x000000FF}
|
, mTextSelectedColor {0x000000FF}
|
||||||
|
@ -386,6 +388,7 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
||||||
mTextHorizontalScrollDelay, mTextHorizontalScrollGap);
|
mTextHorizontalScrollDelay, mTextHorizontalScrollGap);
|
||||||
if (!mGamelistView)
|
if (!mGamelistView)
|
||||||
text->setValue(entry.name);
|
text->setValue(entry.name);
|
||||||
|
text->setBackgroundCornerRadius(mTextBackgroundCornerRadius);
|
||||||
text->setColor(mTextColor);
|
text->setColor(mTextColor);
|
||||||
text->setBackgroundColor(mTextBackgroundColor);
|
text->setBackgroundColor(mTextBackgroundColor);
|
||||||
text->setRenderBackground(true);
|
text->setRenderBackground(true);
|
||||||
|
@ -1708,6 +1711,12 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
if (elem->has("textRelativeScale"))
|
if (elem->has("textRelativeScale"))
|
||||||
mTextRelativeScale = glm::clamp(elem->get<float>("textRelativeScale"), 0.2f, 1.0f);
|
mTextRelativeScale = glm::clamp(elem->get<float>("textRelativeScale"), 0.2f, 1.0f);
|
||||||
|
|
||||||
|
if (elem->has("textBackgroundCornerRadius")) {
|
||||||
|
mTextBackgroundCornerRadius =
|
||||||
|
glm::clamp(elem->get<float>("textBackgroundCornerRadius"), 0.0f, 0.5f) *
|
||||||
|
(mItemScale >= 1.0f ? mItemScale : 1.0f) * mRenderer->getScreenWidth();
|
||||||
|
}
|
||||||
|
|
||||||
if (elem->has("textColor"))
|
if (elem->has("textColor"))
|
||||||
mTextColor = elem->get<unsigned int>("textColor");
|
mTextColor = elem->get<unsigned int>("textColor");
|
||||||
if (elem->has("textBackgroundColor"))
|
if (elem->has("textBackgroundColor"))
|
||||||
|
|
Loading…
Reference in a new issue