mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 12:05:39 +00:00
More design tweaks.
This commit is contained in:
parent
b44703c716
commit
4fafd58da0
|
@ -137,11 +137,17 @@ void DateTimeComponent::update(int deltaTime)
|
||||||
|
|
||||||
void DateTimeComponent::render(const Eigen::Affine3f& parentTrans)
|
void DateTimeComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
{
|
{
|
||||||
Eigen::Affine3f trans = roundMatrix(parentTrans * getTransform());
|
Eigen::Affine3f trans = parentTrans * getTransform();
|
||||||
Renderer::setMatrix(trans);
|
|
||||||
|
|
||||||
if(mTextCache)
|
if(mTextCache)
|
||||||
{
|
{
|
||||||
|
// vertically center
|
||||||
|
Eigen::Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2, 0);
|
||||||
|
trans.translate(off);
|
||||||
|
trans = roundMatrix(trans);
|
||||||
|
|
||||||
|
Renderer::setMatrix(trans);
|
||||||
|
|
||||||
std::shared_ptr<Font> font = getFont();
|
std::shared_ptr<Font> font = getFont();
|
||||||
|
|
||||||
mTextCache->setColor((mColor & 0xFFFFFF00) | getOpacity());
|
mTextCache->setColor((mColor & 0xFFFFFF00) | getOpacity());
|
||||||
|
@ -156,8 +162,6 @@ void DateTimeComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChildren(trans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateTimeComponent::setValue(const std::string& val)
|
void DateTimeComponent::setValue(const std::string& val)
|
||||||
|
|
|
@ -28,7 +28,6 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
|
||||||
|
|
||||||
// selected result name
|
// selected result name
|
||||||
mResultName = std::make_shared<TextComponent>(mWindow, "Result name", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
mResultName = std::make_shared<TextComponent>(mWindow, "Result name", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||||
mGrid.setEntry(mResultName, Vector2i(1, 0), false, true, Vector2i(2, 1), GridFlags::BORDER_TOP);
|
|
||||||
|
|
||||||
// selected result thumbnail
|
// selected result thumbnail
|
||||||
mResultThumbnail = std::make_shared<ImageComponent>(mWindow);
|
mResultThumbnail = std::make_shared<ImageComponent>(mWindow);
|
||||||
|
@ -52,7 +51,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
|
||||||
mMD_Genre = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
|
mMD_Genre = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
|
||||||
mMD_Players = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
|
mMD_Players = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
|
||||||
|
|
||||||
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RATING:", font, mdLblColor), mMD_Rating));
|
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RATING:", font, mdLblColor), mMD_Rating, false));
|
||||||
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RELEASED:", font, mdLblColor), mMD_ReleaseDate));
|
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "RELEASED:", font, mdLblColor), mMD_ReleaseDate));
|
||||||
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "DEVELOPER:", font, mdLblColor), mMD_Developer));
|
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "DEVELOPER:", font, mdLblColor), mMD_Developer));
|
||||||
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "PUBLISHER:", font, mdLblColor), mMD_Publisher));
|
mMD_Pairs.push_back(MetaDataPair(std::make_shared<TextComponent>(mWindow, "PUBLISHER:", font, mdLblColor), mMD_Publisher));
|
||||||
|
@ -64,7 +63,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
|
||||||
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
|
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
|
||||||
{
|
{
|
||||||
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
|
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
|
||||||
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, true);
|
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, it->resize);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +88,12 @@ void ScraperSearchComponent::onSizeChanged()
|
||||||
|
|
||||||
// row heights
|
// row heights
|
||||||
const float fontHeightPerc = (mResultName->getFont()->getHeight()) / mGrid.getSize().y();
|
const float fontHeightPerc = (mResultName->getFont()->getHeight()) / mGrid.getSize().y();
|
||||||
mGrid.setRowHeightPerc(0, fontHeightPerc); // result name
|
|
||||||
|
if(mSearchType == ALWAYS_ACCEPT_FIRST_RESULT) // show name
|
||||||
|
mGrid.setRowHeightPerc(0, fontHeightPerc); // result name
|
||||||
|
else
|
||||||
|
mGrid.setRowHeightPerc(0, 0.05f); // hide name but do padding
|
||||||
|
|
||||||
mGrid.setRowHeightPerc(2, 0.375f); // description
|
mGrid.setRowHeightPerc(2, 0.375f); // description
|
||||||
|
|
||||||
// limit thumbnail size using setMaxHeight - we do this instead of letting mGrid call setSize because it maintains the aspect ratio
|
// limit thumbnail size using setMaxHeight - we do this instead of letting mGrid call setSize because it maintains the aspect ratio
|
||||||
|
@ -124,6 +128,9 @@ void ScraperSearchComponent::onSizeChanged()
|
||||||
|
|
||||||
mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x());
|
mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x());
|
||||||
|
|
||||||
|
// rating is manually sized
|
||||||
|
mMD_Rating->setSize(mMD_Grid->getColWidth(1), fontLbl->getLetterHeight());
|
||||||
|
|
||||||
// make result font follow label font
|
// make result font follow label font
|
||||||
mResultDesc->setFont(Font::get(fontHeight, FONT_PATH_REGULAR));
|
mResultDesc->setFont(Font::get(fontHeight, FONT_PATH_REGULAR));
|
||||||
}
|
}
|
||||||
|
@ -135,17 +142,24 @@ void ScraperSearchComponent::updateViewStyle()
|
||||||
{
|
{
|
||||||
using namespace Eigen;
|
using namespace Eigen;
|
||||||
|
|
||||||
// unlink description and result list
|
// unlink description and result list and result name
|
||||||
|
mGrid.removeEntry(mResultName);
|
||||||
mGrid.removeEntry(mResultDesc);
|
mGrid.removeEntry(mResultDesc);
|
||||||
mGrid.removeEntry(mResultList);
|
mGrid.removeEntry(mResultList);
|
||||||
|
|
||||||
// add them back depending on search type
|
// add them back depending on search type
|
||||||
if(mSearchType == ALWAYS_ACCEPT_FIRST_RESULT)
|
if(mSearchType == ALWAYS_ACCEPT_FIRST_RESULT)
|
||||||
{
|
{
|
||||||
|
// show name
|
||||||
|
mGrid.setEntry(mResultName, Vector2i(1, 0), false, true, Vector2i(2, 1), GridFlags::BORDER_TOP);
|
||||||
|
|
||||||
// show description on the right
|
// show description on the right
|
||||||
mGrid.setEntry(mDescContainer, Vector2i(3, 0), false, true, Vector2i(1, 3), GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
|
mGrid.setEntry(mDescContainer, Vector2i(3, 0), false, true, Vector2i(1, 3), GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
|
||||||
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
|
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
|
||||||
}else{
|
}else{
|
||||||
|
// fake row where name would be
|
||||||
|
mGrid.setEntry(std::make_shared<GuiComponent>(mWindow), Vector2i(1, 0), false, true, Vector2i(2, 1), GridFlags::BORDER_TOP);
|
||||||
|
|
||||||
// show result list on the right
|
// show result list on the right
|
||||||
mGrid.setEntry(mResultList, Vector2i(3, 0), true, true, Vector2i(1, 3), GridFlags::BORDER_LEFT | GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
|
mGrid.setEntry(mResultList, Vector2i(3, 0), true, true, Vector2i(1, 3), GridFlags::BORDER_LEFT | GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
|
||||||
|
|
||||||
|
@ -241,6 +255,11 @@ int ScraperSearchComponent::getSelectedIndex()
|
||||||
void ScraperSearchComponent::updateInfoPane()
|
void ScraperSearchComponent::updateInfoPane()
|
||||||
{
|
{
|
||||||
int i = getSelectedIndex();
|
int i = getSelectedIndex();
|
||||||
|
if(mSearchType == ALWAYS_ACCEPT_FIRST_RESULT && mScraperResults.size())
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(i != -1 && (int)mScraperResults.size() > i)
|
if(i != -1 && (int)mScraperResults.size() > i)
|
||||||
{
|
{
|
||||||
ScraperSearchResult& res = mScraperResults.at(i);
|
ScraperSearchResult& res = mScraperResults.at(i);
|
||||||
|
@ -265,7 +284,7 @@ void ScraperSearchComponent::updateInfoPane()
|
||||||
mMD_Publisher->setText(strToUpper(res.mdl.get("publisher")));
|
mMD_Publisher->setText(strToUpper(res.mdl.get("publisher")));
|
||||||
mMD_Genre->setText(strToUpper(res.mdl.get("genre")));
|
mMD_Genre->setText(strToUpper(res.mdl.get("genre")));
|
||||||
mMD_Players->setText(strToUpper(res.mdl.get("players")));
|
mMD_Players->setText(strToUpper(res.mdl.get("players")));
|
||||||
|
mGrid.onSizeChanged();
|
||||||
}else{
|
}else{
|
||||||
mResultName->setText("");
|
mResultName->setText("");
|
||||||
mResultDesc->setText("");
|
mResultDesc->setText("");
|
||||||
|
|
|
@ -75,7 +75,15 @@ private:
|
||||||
std::shared_ptr<TextComponent> mMD_Players;
|
std::shared_ptr<TextComponent> mMD_Players;
|
||||||
|
|
||||||
// label-component pair
|
// label-component pair
|
||||||
typedef std::pair< std::shared_ptr<TextComponent>, std::shared_ptr<GuiComponent> > MetaDataPair;
|
struct MetaDataPair
|
||||||
|
{
|
||||||
|
std::shared_ptr<TextComponent> first;
|
||||||
|
std::shared_ptr<GuiComponent> second;
|
||||||
|
bool resize;
|
||||||
|
|
||||||
|
MetaDataPair(const std::shared_ptr<TextComponent>& f, const std::shared_ptr<GuiComponent>& s, bool r = true) : first(f), second(s), resize(r) {};
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<MetaDataPair> mMD_Pairs;
|
std::vector<MetaDataPair> mMD_Pairs;
|
||||||
|
|
||||||
SearchType mSearchType;
|
SearchType mSearchType;
|
||||||
|
|
|
@ -47,7 +47,7 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
||||||
mButtonGrid = makeButtonGrid(mWindow, buttons);
|
mButtonGrid = makeButtonGrid(mWindow, buttons);
|
||||||
mGrid.setEntry(mButtonGrid, Vector2i(0, 4), true, false);
|
mGrid.setEntry(mButtonGrid, Vector2i(0, 4), true, false);
|
||||||
|
|
||||||
setSize(Renderer::getScreenWidth() * 0.7f, Renderer::getScreenHeight() * 0.7802f);
|
setSize(Renderer::getScreenWidth() * 0.85f, Renderer::getScreenHeight() * 0.849f);
|
||||||
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
|
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
|
||||||
|
|
||||||
doNextSearch();
|
doNextSearch();
|
||||||
|
|
Loading…
Reference in a new issue