mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
More design tweaks.
Fixed some DateTime sizing stuff to be less weird.
This commit is contained in:
parent
4fafd58da0
commit
98eda43bab
|
@ -7,9 +7,8 @@
|
|||
|
||||
DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window),
|
||||
mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
|
||||
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT))
|
||||
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT)), mSizeSet(false)
|
||||
{
|
||||
mSize << 64, getFont()->getHeight();
|
||||
updateTextCache();
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,9 @@ void DateTimeComponent::updateTextCache()
|
|||
const std::string dispString = getDisplayString(mode);
|
||||
std::shared_ptr<Font> font = getFont();
|
||||
mTextCache = std::unique_ptr<TextCache>(font->buildTextCache(dispString, 0, 0, mColor));
|
||||
setSize(mTextCache->metrics.size);
|
||||
|
||||
if(!mSizeSet)
|
||||
mSize = mTextCache->metrics.size;
|
||||
|
||||
//set up cursor positions
|
||||
mCursorBoxes.clear();
|
||||
|
@ -292,10 +293,12 @@ void DateTimeComponent::setColor(unsigned int color)
|
|||
void DateTimeComponent::setFont(std::shared_ptr<Font> font)
|
||||
{
|
||||
mFont = font;
|
||||
updateTextCache();
|
||||
}
|
||||
|
||||
if(getSize().y() < mFont->getHeight())
|
||||
setSize(getSize().x(), (float)mFont->getHeight());
|
||||
|
||||
void DateTimeComponent::onSizeChanged()
|
||||
{
|
||||
mSizeSet = true;
|
||||
updateTextCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
bool input(InputConfig* config, Input input) override;
|
||||
void update(int deltaTime) override;
|
||||
void render(const Eigen::Affine3f& parentTrans) override;
|
||||
void onSizeChanged() override;
|
||||
|
||||
// Set how the point in time will be displayed:
|
||||
// * DISP_DATE - only display the date.
|
||||
|
@ -58,4 +59,6 @@ private:
|
|||
|
||||
unsigned int mColor;
|
||||
std::shared_ptr<Font> mFont;
|
||||
|
||||
bool mSizeSet;
|
||||
};
|
||||
|
|
|
@ -67,7 +67,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
|
|||
i++;
|
||||
}
|
||||
|
||||
mGrid.setEntry(mMD_Grid, Vector2i(2, 1), false, true);
|
||||
mGrid.setEntry(mMD_Grid, Vector2i(2, 1), false, false);
|
||||
|
||||
// result list
|
||||
mResultList = std::make_shared<ComponentList>(mWindow);
|
||||
|
@ -87,10 +87,8 @@ void ScraperSearchComponent::onSizeChanged()
|
|||
mGrid.setColWidthPerc(3, 0.49f);
|
||||
|
||||
// row heights
|
||||
const float fontHeightPerc = (mResultName->getFont()->getHeight()) / mGrid.getSize().y();
|
||||
|
||||
if(mSearchType == ALWAYS_ACCEPT_FIRST_RESULT) // show name
|
||||
mGrid.setRowHeightPerc(0, fontHeightPerc); // result name
|
||||
mGrid.setRowHeightPerc(0, (mResultName->getFont()->getHeight()) / mGrid.getSize().y()); // result name
|
||||
else
|
||||
mGrid.setRowHeightPerc(0, 0.05f); // hide name but do padding
|
||||
|
||||
|
@ -98,11 +96,10 @@ 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));
|
||||
mResultThumbnail->setMaxSize(mGrid.getColWidth(1) * 0.85f, mGrid.getRowHeight(1) * 0.85f);
|
||||
|
||||
// metadata
|
||||
// (mMD_Grid has already been resized by mGrid)
|
||||
|
||||
mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1) * 0.9f);
|
||||
if(mMD_Grid->getSize().y() > mMD_Pairs.size())
|
||||
{
|
||||
const int fontHeight = (int)(mMD_Grid->getSize().y() / mMD_Pairs.size() * 0.8f);
|
||||
|
@ -130,10 +127,12 @@ void ScraperSearchComponent::onSizeChanged()
|
|||
|
||||
// rating is manually sized
|
||||
mMD_Rating->setSize(mMD_Grid->getColWidth(1), fontLbl->getLetterHeight());
|
||||
mMD_Grid->onSizeChanged();
|
||||
|
||||
// make result font follow label font
|
||||
mResultDesc->setFont(Font::get(fontHeight, FONT_PATH_REGULAR));
|
||||
}
|
||||
mGrid.onSizeChanged();
|
||||
|
||||
mResultDesc->setSize(mDescContainer->getSize().x(), 0); // make desc text wrap at edge of container
|
||||
}
|
||||
|
|
|
@ -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.85f, Renderer::getScreenHeight() * 0.849f);
|
||||
setSize(Renderer::getScreenWidth() * 0.875f, Renderer::getScreenHeight() * 0.849f);
|
||||
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, (Renderer::getScreenHeight() - mSize.y()) / 2);
|
||||
|
||||
doNextSearch();
|
||||
|
|
Loading…
Reference in a new issue