mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
fix black boxes appearing on gamelist after scrolling
This commit is contained in:
parent
3e15aef1fc
commit
474891f4a3
|
@ -443,8 +443,9 @@ void SystemView::getDefaultElements(void)
|
|||
|
||||
// System Info Bar
|
||||
mSystemInfo.setSize(mSize.x(), mSystemInfo.getFont()->getLetterHeight()*2.2f);
|
||||
mSystemInfo.setPosition(0, (mCarousel.pos.y() + mCarousel.size.y()));
|
||||
mSystemInfo.setPosition(0, (mCarousel.pos.y() + mCarousel.size.y() - 0.2f));
|
||||
mSystemInfo.setBackgroundColor(0xDDDDDDD8);
|
||||
mSystemInfo.setRenderBackground(true);
|
||||
mSystemInfo.setFont(Font::get((int)(0.035f * mSize.y()), Font::getDefaultPath()));
|
||||
mSystemInfo.setColor(0x000000FF);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#include "Settings.h"
|
||||
|
||||
TextComponent::TextComponent(Window* window) : GuiComponent(window),
|
||||
mFont(Font::get(FONT_SIZE_MEDIUM)), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(ALIGN_LEFT), mLineSpacing(1.5f), mBgColor(0)
|
||||
mFont(Font::get(FONT_SIZE_MEDIUM)), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(ALIGN_LEFT), mLineSpacing(1.5f), mBgColor(0), mRenderBackground(false)
|
||||
{
|
||||
}
|
||||
|
||||
TextComponent::TextComponent(Window* window, const std::string& text, const std::shared_ptr<Font>& font, unsigned int color, Alignment align,
|
||||
Eigen::Vector3f pos, Eigen::Vector2f size, unsigned int bgcolor) : GuiComponent(window),
|
||||
mFont(NULL), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(align), mLineSpacing(1.5f), mBgColor(0)
|
||||
mFont(NULL), mUppercase(false), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(align), mLineSpacing(1.5f), mBgColor(0), mRenderBackground(false)
|
||||
{
|
||||
setFont(font);
|
||||
setColor(color);
|
||||
|
@ -51,6 +51,11 @@ void TextComponent::setBackgroundColor(unsigned int color)
|
|||
mBgColorOpacity = mBgColor & 0x000000FF;
|
||||
}
|
||||
|
||||
void TextComponent::setRenderBackground(bool render)
|
||||
{
|
||||
mRenderBackground = render;
|
||||
}
|
||||
|
||||
// Scale the opacity
|
||||
void TextComponent::setOpacity(unsigned char opacity)
|
||||
{
|
||||
|
@ -60,10 +65,10 @@ void TextComponent::setOpacity(unsigned char opacity)
|
|||
|
||||
unsigned char o = (unsigned char)((float)opacity / 255.f * (float) mColorOpacity);
|
||||
mColor = (mColor & 0xFFFFFF00) | (unsigned char) o;
|
||||
|
||||
|
||||
unsigned char bgo = (unsigned char)((float)opacity / 255.f * (float)mBgColorOpacity);
|
||||
mBgColor = (mBgColor & 0xFFFFFF00) | (unsigned char)bgo;
|
||||
|
||||
|
||||
onColorChanged();
|
||||
|
||||
GuiComponent::setOpacity(opacity);
|
||||
|
@ -90,10 +95,10 @@ void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
|||
{
|
||||
Eigen::Affine3f trans = parentTrans * getTransform();
|
||||
|
||||
if (mBgColor)
|
||||
if (mRenderBackground)
|
||||
{
|
||||
Renderer::drawRect(getPosition().x(), getPosition().y() - 1,
|
||||
getSize().x(), getSize().y(), mBgColor);
|
||||
Renderer::setMatrix(trans);
|
||||
Renderer::drawRect(0.f, 0.f, mSize.x(), mSize.y(), mBgColor);
|
||||
}
|
||||
|
||||
if(mTextCache)
|
||||
|
@ -233,8 +238,11 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const st
|
|||
if (properties & COLOR && elem->has("color"))
|
||||
setColor(elem->get<unsigned int>("color"));
|
||||
|
||||
if (properties & COLOR && elem->has("backgroundColor"))
|
||||
setRenderBackground(false);
|
||||
if (properties & COLOR && elem->has("backgroundColor")) {
|
||||
setBackgroundColor(elem->get<unsigned int>("backgroundColor"));
|
||||
setRenderBackground(true);
|
||||
}
|
||||
|
||||
if(properties & ALIGNMENT && elem->has("alignment"))
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
void setAlignment(Alignment align);
|
||||
void setLineSpacing(float spacing);
|
||||
void setBackgroundColor(unsigned int color);
|
||||
void setRenderBackground(bool render);
|
||||
|
||||
void render(const Eigen::Affine3f& parentTrans) override;
|
||||
|
||||
|
@ -49,6 +50,7 @@ private:
|
|||
unsigned int mBgColor;
|
||||
unsigned char mColorOpacity;
|
||||
unsigned char mBgColorOpacity;
|
||||
bool mRenderBackground;
|
||||
|
||||
std::shared_ptr<Font> mFont;
|
||||
bool mUppercase;
|
||||
|
|
Loading…
Reference in a new issue