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
719483864c
commit
b44703c716
|
@ -63,6 +63,7 @@ float ComponentGrid::getRowHeight(int row)
|
||||||
|
|
||||||
void ComponentGrid::setColWidthPerc(int col, float width)
|
void ComponentGrid::setColWidthPerc(int col, float width)
|
||||||
{
|
{
|
||||||
|
assert(width >= 0 && width <= 1);
|
||||||
assert(col >= 0 && col < mGridSize.x());
|
assert(col >= 0 && col < mGridSize.x());
|
||||||
mColWidths[col] = width;
|
mColWidths[col] = width;
|
||||||
onSizeChanged();
|
onSizeChanged();
|
||||||
|
@ -70,6 +71,7 @@ void ComponentGrid::setColWidthPerc(int col, float width)
|
||||||
|
|
||||||
void ComponentGrid::setRowHeightPerc(int row, float height)
|
void ComponentGrid::setRowHeightPerc(int row, float height)
|
||||||
{
|
{
|
||||||
|
assert(height >= 0 && height <= 1);
|
||||||
assert(row >= 0 && row < mGridSize.y());
|
assert(row >= 0 && row < mGridSize.y());
|
||||||
mRowHeights[row] = height;
|
mRowHeights[row] = height;
|
||||||
onSizeChanged();
|
onSizeChanged();
|
||||||
|
|
|
@ -95,7 +95,6 @@ void ScraperSearchComponent::onSizeChanged()
|
||||||
// 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
|
||||||
// we also pad a little so it doesn't rub up against the metadata labels
|
// we also pad a little so it doesn't rub up against the metadata labels
|
||||||
mResultThumbnail->setMaxSize(mGrid.getColWidth(1) - 16, mGrid.getRowHeight(1));
|
mResultThumbnail->setMaxSize(mGrid.getColWidth(1) - 16, mGrid.getRowHeight(1));
|
||||||
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
|
|
||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
// (mMD_Grid has already been resized by mGrid)
|
// (mMD_Grid has already been resized by mGrid)
|
||||||
|
@ -124,7 +123,12 @@ void ScraperSearchComponent::onSizeChanged()
|
||||||
mMD_Players->setFont(fontComp);
|
mMD_Players->setFont(fontComp);
|
||||||
|
|
||||||
mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x());
|
mMD_Grid->setColWidthPerc(0, maxLblWidth / mMD_Grid->getSize().x());
|
||||||
|
|
||||||
|
// make result font follow label font
|
||||||
|
mResultDesc->setFont(Font::get(fontHeight, FONT_PATH_REGULAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScraperSearchComponent::updateViewStyle()
|
void ScraperSearchComponent::updateViewStyle()
|
||||||
|
@ -177,7 +181,7 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
|
||||||
|
|
||||||
mScraperResults = results;
|
mScraperResults = results;
|
||||||
|
|
||||||
const int end = results.size() > 5 ? 5 : results.size(); // at max display 5
|
const int end = results.size() > MAX_SCRAPER_RESULTS ? MAX_SCRAPER_RESULTS : results.size(); // at max display 5
|
||||||
|
|
||||||
auto font = Font::get(FONT_SIZE_MEDIUM);
|
auto font = Font::get(FONT_SIZE_MEDIUM);
|
||||||
unsigned int color = 0x777777FF;
|
unsigned int color = 0x777777FF;
|
||||||
|
@ -240,8 +244,8 @@ void ScraperSearchComponent::updateInfoPane()
|
||||||
if(i != -1 && (int)mScraperResults.size() > i)
|
if(i != -1 && (int)mScraperResults.size() > i)
|
||||||
{
|
{
|
||||||
ScraperSearchResult& res = mScraperResults.at(i);
|
ScraperSearchResult& res = mScraperResults.at(i);
|
||||||
mResultName->setText(res.mdl.get("name"));
|
mResultName->setText(strToUpper(res.mdl.get("name")));
|
||||||
mResultDesc->setText(res.mdl.get("desc"));
|
mResultDesc->setText(strToUpper(res.mdl.get("desc")));
|
||||||
mDescContainer->setScrollPos(Eigen::Vector2d(0, 0));
|
mDescContainer->setScrollPos(Eigen::Vector2d(0, 0));
|
||||||
mDescContainer->resetAutoScrollTimer();
|
mDescContainer->resetAutoScrollTimer();
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "../components/ComponentGrid.h"
|
#include "../components/ComponentGrid.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#define MAX_SCRAPER_RESULTS 5
|
#define MAX_SCRAPER_RESULTS 7
|
||||||
|
|
||||||
class ComponentList;
|
class ComponentList;
|
||||||
class ImageComponent;
|
class ImageComponent;
|
||||||
|
|
|
@ -21,7 +21,7 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
||||||
mCurrentGame = 0;
|
mCurrentGame = 0;
|
||||||
|
|
||||||
// set up grid
|
// set up grid
|
||||||
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x777777FF, TextComponent::ALIGN_CENTER);
|
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
|
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
|
||||||
|
|
||||||
mSystem = std::make_shared<TextComponent>(mWindow, "SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
mSystem = std::make_shared<TextComponent>(mWindow, "SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
|
@ -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.65f);
|
setSize(Renderer::getScreenWidth() * 0.7f, Renderer::getScreenHeight() * 0.7802f);
|
||||||
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
|
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
|
||||||
|
|
||||||
doNextSearch();
|
doNextSearch();
|
||||||
|
@ -58,9 +58,9 @@ void GuiScraperMulti::onSizeChanged()
|
||||||
mBackground.fitTo(mSize, Vector3f::Zero(), Vector2f(-32, -32));
|
mBackground.fitTo(mSize, Vector3f::Zero(), Vector2f(-32, -32));
|
||||||
mGrid.setSize(mSize);
|
mGrid.setSize(mSize);
|
||||||
|
|
||||||
mGrid.setRowHeightPerc(0, mTitle->getFont()->getHeight() / mGrid.getSize().y());
|
mGrid.setRowHeightPerc(0, mTitle->getFont()->getLetterHeight() * 1.9725f / mGrid.getSize().y());
|
||||||
mGrid.setRowHeightPerc(1, mSystem->getFont()->getHeight() / mGrid.getSize().y());
|
mGrid.setRowHeightPerc(1, (mSystem->getFont()->getLetterHeight() + 2) / mGrid.getSize().y());
|
||||||
mGrid.setRowHeightPerc(2, mSubtitle->getFont()->getHeight() / mGrid.getSize().y());
|
mGrid.setRowHeightPerc(2, mSubtitle->getFont()->getHeight() * 1.75f / mGrid.getSize().y());
|
||||||
mGrid.setRowHeightPerc(4, mButtonGrid->getSize().y() / mGrid.getSize().y());
|
mGrid.setRowHeightPerc(4, mButtonGrid->getSize().y() / mGrid.getSize().y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ void GuiScraperMulti::doNextSearch()
|
||||||
|
|
||||||
// update title
|
// update title
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
mSystem->setText(strToUpper(mSearchQueue.front().system->getName()));
|
mSystem->setText(strToUpper(mSearchQueue.front().system->getFullName()));
|
||||||
|
|
||||||
// update subtitle
|
// update subtitle
|
||||||
ss.str(""); // clear
|
ss.str(""); // clear
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TextCache;
|
||||||
|
|
||||||
#define FONT_SIZE_SMALL ((unsigned int)(0.035f * Renderer::getScreenHeight()))
|
#define FONT_SIZE_SMALL ((unsigned int)(0.035f * Renderer::getScreenHeight()))
|
||||||
#define FONT_SIZE_MEDIUM ((unsigned int)(0.045f * Renderer::getScreenHeight()))
|
#define FONT_SIZE_MEDIUM ((unsigned int)(0.045f * Renderer::getScreenHeight()))
|
||||||
#define FONT_SIZE_LARGE ((unsigned int)(0.1f * Renderer::getScreenHeight()))
|
#define FONT_SIZE_LARGE ((unsigned int)(0.085f * Renderer::getScreenHeight()))
|
||||||
|
|
||||||
#define FONT_PATH_LIGHT ":/opensans_hebrew_condensed_light.ttf"
|
#define FONT_PATH_LIGHT ":/opensans_hebrew_condensed_light.ttf"
|
||||||
#define FONT_PATH_REGULAR ":/opensans_hebrew_condensed_regular.ttf"
|
#define FONT_PATH_REGULAR ":/opensans_hebrew_condensed_regular.ttf"
|
||||||
|
|
Loading…
Reference in a new issue