mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Eliminated a lot of unnecessary text rasterization when populating the gamelist carousel.
This commit is contained in:
parent
0736192417
commit
369cc7684b
|
@ -36,10 +36,11 @@ TextComponent::TextComponent()
|
||||||
TextComponent::TextComponent(const std::string& text,
|
TextComponent::TextComponent(const std::string& text,
|
||||||
const std::shared_ptr<Font>& font,
|
const std::shared_ptr<Font>& font,
|
||||||
unsigned int color,
|
unsigned int color,
|
||||||
Alignment align,
|
Alignment horizontalAlignment,
|
||||||
glm::vec3 pos,
|
glm::vec3 pos,
|
||||||
glm::vec2 size,
|
glm::vec2 size,
|
||||||
unsigned int bgcolor)
|
unsigned int bgcolor,
|
||||||
|
Alignment verticalAlignment)
|
||||||
: mFont {nullptr}
|
: mFont {nullptr}
|
||||||
, mRenderer {Renderer::getInstance()}
|
, mRenderer {Renderer::getInstance()}
|
||||||
, mColor {0x000000FF}
|
, mColor {0x000000FF}
|
||||||
|
@ -51,8 +52,8 @@ TextComponent::TextComponent(const std::string& text,
|
||||||
, mLowercase {false}
|
, mLowercase {false}
|
||||||
, mCapitalize {false}
|
, mCapitalize {false}
|
||||||
, mAutoCalcExtent {1, 1}
|
, mAutoCalcExtent {1, 1}
|
||||||
, mHorizontalAlignment {align}
|
, mHorizontalAlignment {horizontalAlignment}
|
||||||
, mVerticalAlignment {ALIGN_CENTER}
|
, mVerticalAlignment {verticalAlignment}
|
||||||
, mLineSpacing {1.5f}
|
, mLineSpacing {1.5f}
|
||||||
, mNoTopMargin {false}
|
, mNoTopMargin {false}
|
||||||
, mSelectable {false}
|
, mSelectable {false}
|
||||||
|
|
|
@ -28,10 +28,11 @@ public:
|
||||||
TextComponent(const std::string& text,
|
TextComponent(const std::string& text,
|
||||||
const std::shared_ptr<Font>& font,
|
const std::shared_ptr<Font>& font,
|
||||||
unsigned int color = 0x000000FF,
|
unsigned int color = 0x000000FF,
|
||||||
Alignment align = ALIGN_LEFT,
|
Alignment horizontalAlignment = ALIGN_LEFT,
|
||||||
glm::vec3 pos = {0.0f, 0.0f, 0.0f},
|
glm::vec3 pos = {0.0f, 0.0f, 0.0f},
|
||||||
glm::vec2 size = {0.0f, 0.0f},
|
glm::vec2 size = {0.0f, 0.0f},
|
||||||
unsigned int bgcolor = 0x00000000);
|
unsigned int bgcolor = 0x00000000,
|
||||||
|
Alignment verticalAlignment = ALIGN_CENTER);
|
||||||
|
|
||||||
void setFont(const std::shared_ptr<Font>& font);
|
void setFont(const std::shared_ptr<Font>& font);
|
||||||
void setUppercase(bool uppercase);
|
void setUppercase(bool uppercase);
|
||||||
|
|
|
@ -270,8 +270,9 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
||||||
else
|
else
|
||||||
nameEntry = entry.name;
|
nameEntry = entry.name;
|
||||||
|
|
||||||
auto text = std::make_shared<TextComponent>(nameEntry, mFont, 0x000000FF, ALIGN_CENTER);
|
auto text = std::make_shared<TextComponent>(
|
||||||
text->setSize(mItemSize * mItemScale);
|
nameEntry, mFont, 0x000000FF, mItemHorizontalAlignment, glm::vec3 {0.0f, 0.0f, 0.0f},
|
||||||
|
mItemSize * mItemScale, 0x00000000, mItemVerticalAlignment);
|
||||||
if (legacyMode) {
|
if (legacyMode) {
|
||||||
text->applyTheme(theme, "system", "text_logoText",
|
text->applyTheme(theme, "system", "text_logoText",
|
||||||
ThemeFlags::FONT_PATH | ThemeFlags::FONT_SIZE | ThemeFlags::COLOR |
|
ThemeFlags::FONT_PATH | ThemeFlags::FONT_SIZE | ThemeFlags::COLOR |
|
||||||
|
@ -289,9 +290,6 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
||||||
text->setRenderBackground(true);
|
text->setRenderBackground(true);
|
||||||
}
|
}
|
||||||
entry.data.item = text;
|
entry.data.item = text;
|
||||||
|
|
||||||
text->setHorizontalAlignment(mItemHorizontalAlignment);
|
|
||||||
text->setVerticalAlignment(mItemVerticalAlignment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set origin for the items based on their alignment so they line up properly.
|
// Set origin for the items based on their alignment so they line up properly.
|
||||||
|
|
Loading…
Reference in a new issue