mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Redid SystemView to keep "selected" versions of logos.
Should make SVG logos look better + no more pixelated text.
This commit is contained in:
parent
e719a867be
commit
aa65a80039
|
@ -37,17 +37,32 @@ void SystemView::populate()
|
||||||
ImageComponent* logo = new ImageComponent(mWindow);
|
ImageComponent* logo = new ImageComponent(mWindow);
|
||||||
logo->setMaxSize(logoSize());
|
logo->setMaxSize(logoSize());
|
||||||
logo->applyTheme((*it)->getTheme(), "system", "logo", ThemeFlags::PATH);
|
logo->applyTheme((*it)->getTheme(), "system", "logo", ThemeFlags::PATH);
|
||||||
logo->setPosition((logoSize().x() - logo->getSize().x()) / 2, (logoSize().y() - logo->getSize().y()) / 2); // vertically and horizontally center
|
logo->setPosition((logoSize().x() - logo->getSize().x()) / 2, (logoSize().y() - logo->getSize().y()) / 2); // center
|
||||||
e.data.logo = std::shared_ptr<GuiComponent>(logo);
|
e.data.logo = std::shared_ptr<GuiComponent>(logo);
|
||||||
|
|
||||||
|
ImageComponent* logoSelected = new ImageComponent(mWindow);
|
||||||
|
logoSelected->setMaxSize(logoSize() * SELECTED_SCALE);
|
||||||
|
logoSelected->applyTheme((*it)->getTheme(), "system", "logo", ThemeFlags::PATH);
|
||||||
|
logoSelected->setPosition((logoSize().x() - logoSelected->getSize().x()) / 2,
|
||||||
|
(logoSize().y() - logoSelected->getSize().y()) / 2); // center
|
||||||
|
e.data.logoSelected = std::shared_ptr<GuiComponent>(logoSelected);
|
||||||
}else{
|
}else{
|
||||||
// no logo in theme; use text
|
// no logo in theme; use text
|
||||||
TextComponent* text = new TextComponent(mWindow);
|
TextComponent* text = new TextComponent(mWindow,
|
||||||
text->setFont(Font::get(FONT_SIZE_LARGE));
|
(*it)->getName(),
|
||||||
text->setText((*it)->getName());
|
Font::get(FONT_SIZE_LARGE),
|
||||||
text->setSize(logoSize().x(), 0);
|
0x000000FF,
|
||||||
text->setPosition(0, (logoSize().y() - text->getSize().y()) / 2); // vertically center
|
TextComponent::ALIGN_CENTER);
|
||||||
text->setAlignment(TextComponent::ALIGN_CENTER);
|
text->setSize(logoSize());
|
||||||
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
||||||
|
|
||||||
|
TextComponent* textSelected = new TextComponent(mWindow,
|
||||||
|
(*it)->getName(),
|
||||||
|
Font::get((int)(FONT_SIZE_LARGE * SELECTED_SCALE)),
|
||||||
|
0x000000FF,
|
||||||
|
TextComponent::ALIGN_CENTER);
|
||||||
|
textSelected->setSize(logoSize());
|
||||||
|
e.data.logoSelected = std::shared_ptr<GuiComponent>(textSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make background extras
|
// make background extras
|
||||||
|
@ -178,25 +193,17 @@ void SystemView::render(const Eigen::Affine3f& parentTrans)
|
||||||
|
|
||||||
logoTrans.translation() = trans.translation() + Eigen::Vector3f(i * logoSizeX + xOff, yOff, 0);
|
logoTrans.translation() = trans.translation() + Eigen::Vector3f(i * logoSizeX + xOff, yOff, 0);
|
||||||
|
|
||||||
std::shared_ptr<GuiComponent> comp = mEntries.at(index).data.logo;
|
|
||||||
if(comp)
|
|
||||||
{
|
|
||||||
if(index == mCursor) //scale our selection up
|
if(index == mCursor) //scale our selection up
|
||||||
{
|
{
|
||||||
|
// selected
|
||||||
|
const std::shared_ptr<GuiComponent>& comp = mEntries.at(index).data.logoSelected;
|
||||||
comp->setOpacity(0xFF);
|
comp->setOpacity(0xFF);
|
||||||
|
comp->render(logoTrans);
|
||||||
// fix the centering because we go by left corner and not center (bleh)
|
|
||||||
// CAN SOMEONE WHO ACTUALLY UNDERSTANDS MATRICES GIVE AN ACTUAL IMPLEMENTATION OF THIS THAT ACTUALLY WORKS?
|
|
||||||
logoTrans.translation() -= Eigen::Vector3f(((comp->getSize().x() + comp->getPosition().x()) * (1/SELECTED_SCALE)) / 2,
|
|
||||||
((comp->getSize().y() + comp->getPosition().y()) * (1/SELECTED_SCALE)) / 2, 0);
|
|
||||||
|
|
||||||
logoTrans.scale(Eigen::Vector3f(SELECTED_SCALE, SELECTED_SCALE, 1.0f));
|
|
||||||
mEntries.at(index).data.logo->render(logoTrans);
|
|
||||||
logoTrans.scale(Eigen::Vector3f(1/SELECTED_SCALE, 1/SELECTED_SCALE, 1.0f));
|
|
||||||
}else{
|
}else{
|
||||||
|
// not selected
|
||||||
|
const std::shared_ptr<GuiComponent>& comp = mEntries.at(index).data.logo;
|
||||||
comp->setOpacity(0x80);
|
comp->setOpacity(0x80);
|
||||||
mEntries.at(index).data.logo->render(logoTrans);
|
comp->render(logoTrans);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ class SystemData;
|
||||||
struct SystemViewData
|
struct SystemViewData
|
||||||
{
|
{
|
||||||
std::shared_ptr<GuiComponent> logo;
|
std::shared_ptr<GuiComponent> logo;
|
||||||
|
std::shared_ptr<GuiComponent> logoSelected;
|
||||||
std::shared_ptr<ThemeExtras> backgroundExtras;
|
std::shared_ptr<ThemeExtras> backgroundExtras;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue