mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Added a textHorizontalScrollGap property to CarouselComponent and TextListComponent
This commit is contained in:
parent
6ae8c87864
commit
98482f45c9
|
@ -153,6 +153,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"textHorizontalScrolling", BOOLEAN},
|
||||
{"textHorizontalScrollSpeed", FLOAT},
|
||||
{"textHorizontalScrollDelay", FLOAT},
|
||||
{"textHorizontalScrollGap", FLOAT},
|
||||
{"fontPath", PATH},
|
||||
{"fontSize", FLOAT},
|
||||
{"letterCase", STRING},
|
||||
|
@ -239,6 +240,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"textHorizontalScrolling", BOOLEAN},
|
||||
{"textHorizontalScrollSpeed", FLOAT},
|
||||
{"textHorizontalScrollDelay", FLOAT},
|
||||
{"textHorizontalScrollGap", FLOAT},
|
||||
{"fontPath", PATH},
|
||||
{"fontSize", FLOAT},
|
||||
{"horizontalAlignment", STRING},
|
||||
|
|
|
@ -203,6 +203,7 @@ private:
|
|||
bool mTextHorizontalScrolling;
|
||||
float mTextHorizontalScrollSpeed;
|
||||
float mTextHorizontalScrollDelay;
|
||||
float mTextHorizontalScrollGap;
|
||||
std::shared_ptr<Font> mFont;
|
||||
LetterCase mLetterCase;
|
||||
LetterCase mLetterCaseAutoCollections;
|
||||
|
@ -277,6 +278,7 @@ CarouselComponent<T>::CarouselComponent()
|
|||
, mTextHorizontalScrolling {false}
|
||||
, mTextHorizontalScrollSpeed {1.0f}
|
||||
, mTextHorizontalScrollDelay {3000.0f}
|
||||
, mTextHorizontalScrollGap {1.5f}
|
||||
, mFont {Font::get(FONT_SIZE_LARGE_FIXED)}
|
||||
, mLetterCase {LetterCase::NONE}
|
||||
, mLetterCaseAutoCollections {LetterCase::UNDEFINED}
|
||||
|
@ -366,7 +368,7 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
|||
glm::vec3 {0.0f, 0.0f, 0.0f},
|
||||
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)), 0x00000000,
|
||||
mLineSpacing, mTextRelativeScale, mTextHorizontalScrolling, mTextHorizontalScrollSpeed,
|
||||
mTextHorizontalScrollDelay, 1.0f);
|
||||
mTextHorizontalScrollDelay, mTextHorizontalScrollGap);
|
||||
if (!mGamelistView)
|
||||
text->setValue(entry.name);
|
||||
text->setColor(mTextColor);
|
||||
|
@ -1691,6 +1693,11 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
glm::clamp(elem->get<float>("textHorizontalScrollDelay"), 0.0f, 10.0f) * 1000.0f;
|
||||
}
|
||||
|
||||
if (elem->has("textHorizontalScrollGap")) {
|
||||
mTextHorizontalScrollGap =
|
||||
glm::clamp(elem->get<float>("textHorizontalScrollGap"), 0.1f, 5.0f);
|
||||
}
|
||||
|
||||
if (elem->has("lineSpacing"))
|
||||
mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f);
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ private:
|
|||
bool mHorizontalScrolling;
|
||||
float mHorizontalScrollSpeed;
|
||||
float mHorizontalScrollDelay;
|
||||
float mTextHorizontalScrollGap;
|
||||
PrimaryAlignment mAlignment;
|
||||
float mHorizontalMargin;
|
||||
LetterCase mLetterCase;
|
||||
|
@ -176,6 +177,7 @@ TextListComponent<T>::TextListComponent()
|
|||
, mHorizontalScrolling {true}
|
||||
, mHorizontalScrollSpeed {1.0f}
|
||||
, mHorizontalScrollDelay {3000.0f}
|
||||
, mTextHorizontalScrollGap {1.5f}
|
||||
, mAlignment {PrimaryAlignment::ALIGN_CENTER}
|
||||
, mHorizontalMargin {0.0f}
|
||||
, mLetterCase {LetterCase::NONE}
|
||||
|
@ -204,6 +206,7 @@ void TextListComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
|||
// Set the text width to the width of the textlist to trigger horizontal scrolling.
|
||||
entry.data.entryName->setHorizontalScrollingSpeedMultiplier(mHorizontalScrollSpeed);
|
||||
entry.data.entryName->setHorizontalScrollingDelay(mHorizontalScrollDelay);
|
||||
entry.data.entryName->setHorizontalScrollingGap(mTextHorizontalScrollGap);
|
||||
entry.data.entryName->setHorizontalScrolling(true);
|
||||
textSize.x = mSize.x - (mHorizontalMargin * 2.0f);
|
||||
entry.data.entryName->setSize(textSize);
|
||||
|
@ -494,6 +497,11 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
glm::clamp(elem->get<float>("textHorizontalScrollDelay"), 0.0f, 10.0f) * 1000.0f;
|
||||
}
|
||||
|
||||
if (elem->has("textHorizontalScrollGap")) {
|
||||
mTextHorizontalScrollGap =
|
||||
glm::clamp(elem->get<float>("textHorizontalScrollGap"), 0.1f, 5.0f);
|
||||
}
|
||||
|
||||
mFont = Font::getFromTheme(elem, properties, mFont, 0.0f, false);
|
||||
|
||||
const float selectorHeight {mFont->getHeight(mLineSpacing)};
|
||||
|
|
Loading…
Reference in a new issue