Commit b44703c7 authored by Aloshi's avatar Aloshi

More design tweaks.

parent 71948386
......@@ -63,6 +63,7 @@ float ComponentGrid::getRowHeight(int row)
void ComponentGrid::setColWidthPerc(int col, float width)
{
assert(width >= 0 && width <= 1);
assert(col >= 0 && col < mGridSize.x());
mColWidths[col] = width;
onSizeChanged();
......@@ -70,6 +71,7 @@ void ComponentGrid::setColWidthPerc(int col, float width)
void ComponentGrid::setRowHeightPerc(int row, float height)
{
assert(height >= 0 && height <= 1);
assert(row >= 0 && row < mGridSize.y());
mRowHeights[row] = height;
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
// we also pad a little so it doesn't rub up against the metadata labels
mResultThumbnail->setMaxSize(mGrid.getColWidth(1) - 16, mGrid.getRowHeight(1));
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
// metadata
// (mMD_Grid has already been resized by mGrid)
......@@ -124,7 +123,12 @@ void ScraperSearchComponent::onSizeChanged()
mMD_Players->setFont(fontComp);
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()
......@@ -177,7 +181,7 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
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);
unsigned int color = 0x777777FF;
......@@ -240,8 +244,8 @@ void ScraperSearchComponent::updateInfoPane()
if(i != -1 && (int)mScraperResults.size() > i)
{
ScraperSearchResult& res = mScraperResults.at(i);
mResultName->setText(res.mdl.get("name"));
mResultDesc->setText(res.mdl.get("desc"));
mResultName->setText(strToUpper(res.mdl.get("name")));
mResultDesc->setText(strToUpper(res.mdl.get("desc")));
mDescContainer->setScrollPos(Eigen::Vector2d(0, 0));
mDescContainer->resetAutoScrollTimer();
......
......@@ -5,7 +5,7 @@
#include "../components/ComponentGrid.h"
#include <functional>
#define MAX_SCRAPER_RESULTS 5
#define MAX_SCRAPER_RESULTS 7
class ComponentList;
class ImageComponent;
......
......@@ -21,7 +21,7 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
mCurrentGame = 0;
// 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);
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);
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);
doNextSearch();
......@@ -58,9 +58,9 @@ void GuiScraperMulti::onSizeChanged()
mBackground.fitTo(mSize, Vector3f::Zero(), Vector2f(-32, -32));
mGrid.setSize(mSize);
mGrid.setRowHeightPerc(0, mTitle->getFont()->getHeight() / mGrid.getSize().y());
mGrid.setRowHeightPerc(1, mSystem->getFont()->getHeight() / mGrid.getSize().y());
mGrid.setRowHeightPerc(2, mSubtitle->getFont()->getHeight() / mGrid.getSize().y());
mGrid.setRowHeightPerc(0, mTitle->getFont()->getLetterHeight() * 1.9725f / mGrid.getSize().y());
mGrid.setRowHeightPerc(1, (mSystem->getFont()->getLetterHeight() + 2) / mGrid.getSize().y());
mGrid.setRowHeightPerc(2, mSubtitle->getFont()->getHeight() * 1.75f / mGrid.getSize().y());
mGrid.setRowHeightPerc(4, mButtonGrid->getSize().y() / mGrid.getSize().y());
}
......@@ -74,7 +74,7 @@ void GuiScraperMulti::doNextSearch()
// update title
std::stringstream ss;
mSystem->setText(strToUpper(mSearchQueue.front().system->getName()));
mSystem->setText(strToUpper(mSearchQueue.front().system->getFullName()));
// update subtitle
ss.str(""); // clear
......
......@@ -14,7 +14,7 @@ class TextCache;
#define FONT_SIZE_SMALL ((unsigned int)(0.035f * 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_REGULAR ":/opensans_hebrew_condensed_regular.ttf"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment