mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23: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},
|
{"textHorizontalScrolling", BOOLEAN},
|
||||||
{"textHorizontalScrollSpeed", FLOAT},
|
{"textHorizontalScrollSpeed", FLOAT},
|
||||||
{"textHorizontalScrollDelay", FLOAT},
|
{"textHorizontalScrollDelay", FLOAT},
|
||||||
|
{"textHorizontalScrollGap", FLOAT},
|
||||||
{"fontPath", PATH},
|
{"fontPath", PATH},
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"letterCase", STRING},
|
{"letterCase", STRING},
|
||||||
|
@ -239,6 +240,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"textHorizontalScrolling", BOOLEAN},
|
{"textHorizontalScrolling", BOOLEAN},
|
||||||
{"textHorizontalScrollSpeed", FLOAT},
|
{"textHorizontalScrollSpeed", FLOAT},
|
||||||
{"textHorizontalScrollDelay", FLOAT},
|
{"textHorizontalScrollDelay", FLOAT},
|
||||||
|
{"textHorizontalScrollGap", FLOAT},
|
||||||
{"fontPath", PATH},
|
{"fontPath", PATH},
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
|
|
|
@ -203,6 +203,7 @@ private:
|
||||||
bool mTextHorizontalScrolling;
|
bool mTextHorizontalScrolling;
|
||||||
float mTextHorizontalScrollSpeed;
|
float mTextHorizontalScrollSpeed;
|
||||||
float mTextHorizontalScrollDelay;
|
float mTextHorizontalScrollDelay;
|
||||||
|
float mTextHorizontalScrollGap;
|
||||||
std::shared_ptr<Font> mFont;
|
std::shared_ptr<Font> mFont;
|
||||||
LetterCase mLetterCase;
|
LetterCase mLetterCase;
|
||||||
LetterCase mLetterCaseAutoCollections;
|
LetterCase mLetterCaseAutoCollections;
|
||||||
|
@ -277,6 +278,7 @@ CarouselComponent<T>::CarouselComponent()
|
||||||
, mTextHorizontalScrolling {false}
|
, mTextHorizontalScrolling {false}
|
||||||
, mTextHorizontalScrollSpeed {1.0f}
|
, mTextHorizontalScrollSpeed {1.0f}
|
||||||
, mTextHorizontalScrollDelay {3000.0f}
|
, mTextHorizontalScrollDelay {3000.0f}
|
||||||
|
, mTextHorizontalScrollGap {1.5f}
|
||||||
, mFont {Font::get(FONT_SIZE_LARGE_FIXED)}
|
, mFont {Font::get(FONT_SIZE_LARGE_FIXED)}
|
||||||
, mLetterCase {LetterCase::NONE}
|
, mLetterCase {LetterCase::NONE}
|
||||||
, mLetterCaseAutoCollections {LetterCase::UNDEFINED}
|
, 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::vec3 {0.0f, 0.0f, 0.0f},
|
||||||
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)), 0x00000000,
|
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)), 0x00000000,
|
||||||
mLineSpacing, mTextRelativeScale, mTextHorizontalScrolling, mTextHorizontalScrollSpeed,
|
mLineSpacing, mTextRelativeScale, mTextHorizontalScrolling, mTextHorizontalScrollSpeed,
|
||||||
mTextHorizontalScrollDelay, 1.0f);
|
mTextHorizontalScrollDelay, mTextHorizontalScrollGap);
|
||||||
if (!mGamelistView)
|
if (!mGamelistView)
|
||||||
text->setValue(entry.name);
|
text->setValue(entry.name);
|
||||||
text->setColor(mTextColor);
|
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;
|
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"))
|
if (elem->has("lineSpacing"))
|
||||||
mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f);
|
mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f);
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,7 @@ private:
|
||||||
bool mHorizontalScrolling;
|
bool mHorizontalScrolling;
|
||||||
float mHorizontalScrollSpeed;
|
float mHorizontalScrollSpeed;
|
||||||
float mHorizontalScrollDelay;
|
float mHorizontalScrollDelay;
|
||||||
|
float mTextHorizontalScrollGap;
|
||||||
PrimaryAlignment mAlignment;
|
PrimaryAlignment mAlignment;
|
||||||
float mHorizontalMargin;
|
float mHorizontalMargin;
|
||||||
LetterCase mLetterCase;
|
LetterCase mLetterCase;
|
||||||
|
@ -176,6 +177,7 @@ TextListComponent<T>::TextListComponent()
|
||||||
, mHorizontalScrolling {true}
|
, mHorizontalScrolling {true}
|
||||||
, mHorizontalScrollSpeed {1.0f}
|
, mHorizontalScrollSpeed {1.0f}
|
||||||
, mHorizontalScrollDelay {3000.0f}
|
, mHorizontalScrollDelay {3000.0f}
|
||||||
|
, mTextHorizontalScrollGap {1.5f}
|
||||||
, mAlignment {PrimaryAlignment::ALIGN_CENTER}
|
, mAlignment {PrimaryAlignment::ALIGN_CENTER}
|
||||||
, mHorizontalMargin {0.0f}
|
, mHorizontalMargin {0.0f}
|
||||||
, mLetterCase {LetterCase::NONE}
|
, 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.
|
// Set the text width to the width of the textlist to trigger horizontal scrolling.
|
||||||
entry.data.entryName->setHorizontalScrollingSpeedMultiplier(mHorizontalScrollSpeed);
|
entry.data.entryName->setHorizontalScrollingSpeedMultiplier(mHorizontalScrollSpeed);
|
||||||
entry.data.entryName->setHorizontalScrollingDelay(mHorizontalScrollDelay);
|
entry.data.entryName->setHorizontalScrollingDelay(mHorizontalScrollDelay);
|
||||||
|
entry.data.entryName->setHorizontalScrollingGap(mTextHorizontalScrollGap);
|
||||||
entry.data.entryName->setHorizontalScrolling(true);
|
entry.data.entryName->setHorizontalScrolling(true);
|
||||||
textSize.x = mSize.x - (mHorizontalMargin * 2.0f);
|
textSize.x = mSize.x - (mHorizontalMargin * 2.0f);
|
||||||
entry.data.entryName->setSize(textSize);
|
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;
|
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);
|
mFont = Font::getFromTheme(elem, properties, mFont, 0.0f, false);
|
||||||
|
|
||||||
const float selectorHeight {mFont->getHeight(mLineSpacing)};
|
const float selectorHeight {mFont->getHeight(mLineSpacing)};
|
||||||
|
|
Loading…
Reference in a new issue