fix black boxes appearing on gamelist after scrolling

This commit is contained in:
jrassa 2017-04-30 22:54:27 -04:00
parent 3e15aef1fc
commit 474891f4a3
3 changed files with 20 additions and 9 deletions

View file

@ -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);
}

View file

@ -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)
{
@ -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"))
{

View file

@ -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;