mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05: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,
|
||||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color,
|
||||
Alignment align,
|
||||
Alignment horizontalAlignment,
|
||||
glm::vec3 pos,
|
||||
glm::vec2 size,
|
||||
unsigned int bgcolor)
|
||||
unsigned int bgcolor,
|
||||
Alignment verticalAlignment)
|
||||
: mFont {nullptr}
|
||||
, mRenderer {Renderer::getInstance()}
|
||||
, mColor {0x000000FF}
|
||||
|
@ -51,8 +52,8 @@ TextComponent::TextComponent(const std::string& text,
|
|||
, mLowercase {false}
|
||||
, mCapitalize {false}
|
||||
, mAutoCalcExtent {1, 1}
|
||||
, mHorizontalAlignment {align}
|
||||
, mVerticalAlignment {ALIGN_CENTER}
|
||||
, mHorizontalAlignment {horizontalAlignment}
|
||||
, mVerticalAlignment {verticalAlignment}
|
||||
, mLineSpacing {1.5f}
|
||||
, mNoTopMargin {false}
|
||||
, mSelectable {false}
|
||||
|
|
|
@ -28,10 +28,11 @@ public:
|
|||
TextComponent(const std::string& text,
|
||||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color = 0x000000FF,
|
||||
Alignment align = ALIGN_LEFT,
|
||||
Alignment horizontalAlignment = ALIGN_LEFT,
|
||||
glm::vec3 pos = {0.0f, 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 setUppercase(bool uppercase);
|
||||
|
|
|
@ -270,8 +270,9 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
|||
else
|
||||
nameEntry = entry.name;
|
||||
|
||||
auto text = std::make_shared<TextComponent>(nameEntry, mFont, 0x000000FF, ALIGN_CENTER);
|
||||
text->setSize(mItemSize * mItemScale);
|
||||
auto text = std::make_shared<TextComponent>(
|
||||
nameEntry, mFont, 0x000000FF, mItemHorizontalAlignment, glm::vec3 {0.0f, 0.0f, 0.0f},
|
||||
mItemSize * mItemScale, 0x00000000, mItemVerticalAlignment);
|
||||
if (legacyMode) {
|
||||
text->applyTheme(theme, "system", "text_logoText",
|
||||
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);
|
||||
}
|
||||
entry.data.item = text;
|
||||
|
||||
text->setHorizontalAlignment(mItemHorizontalAlignment);
|
||||
text->setVerticalAlignment(mItemVerticalAlignment);
|
||||
}
|
||||
|
||||
// Set origin for the items based on their alignment so they line up properly.
|
||||
|
|
Loading…
Reference in a new issue