mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Changed Font::getHeight to return a float like it should.
Added minimum message height to GuiMsgBox. TextComponent now vertically centers text. Fixed a bug that would cause ScraperSearchComponent to return results continuously until another search was started.
This commit is contained in:
parent
8e5c910de3
commit
daa62123d1
|
@ -334,8 +334,11 @@ void ScraperSearchComponent::update(int deltaTime)
|
||||||
{
|
{
|
||||||
if(mMDResolveHandle->status() == ASYNC_DONE)
|
if(mMDResolveHandle->status() == ASYNC_DONE)
|
||||||
{
|
{
|
||||||
|
ScraperSearchResult result = mMDResolveHandle->getResult();
|
||||||
|
mMDResolveHandle.reset();
|
||||||
|
|
||||||
// this might end in us being deleted, depending on mAcceptCallback - so make sure this is the last thing we do in update()
|
// this might end in us being deleted, depending on mAcceptCallback - so make sure this is the last thing we do in update()
|
||||||
returnResult(mMDResolveHandle->getResult());
|
returnResult(result);
|
||||||
}else if(mMDResolveHandle->status() == ASYNC_ERROR)
|
}else if(mMDResolveHandle->status() == ASYNC_ERROR)
|
||||||
{
|
{
|
||||||
onSearchError(mMDResolveHandle->getStatusString());
|
onSearchError(mMDResolveHandle->getStatusString());
|
||||||
|
|
|
@ -79,7 +79,7 @@ void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
if(mCentered)
|
if(mCentered)
|
||||||
{
|
{
|
||||||
const Eigen::Vector2f& textSize = mTextCache->metrics.size;
|
const Eigen::Vector2f& textSize = mTextCache->metrics.size;
|
||||||
Eigen::Vector3f off((getSize().x() - textSize.x()) / 2, 0, 0);
|
Eigen::Vector3f off((getSize().x() - textSize.x()) / 2, (getSize().y() - textSize.y()) / 2, 0);
|
||||||
|
|
||||||
trans.translate(off);
|
trans.translate(off);
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
|
|
|
@ -206,7 +206,7 @@ void TextEditComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
cursorPos[1] = 0;
|
cursorPos[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::drawRect((int)cursorPos.x(), (int)cursorPos.y(), 3, f->getHeight(), 0x000000FF);
|
Renderer::drawRect((int)cursorPos.x(), (int)cursorPos.y(), 3, (int)f->getHeight(), 0x000000FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::popClipRect();
|
Renderer::popClipRect();
|
||||||
|
|
|
@ -129,7 +129,7 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
|
||||||
}
|
}
|
||||||
|
|
||||||
const int cutoff = 0;
|
const int cutoff = 0;
|
||||||
const int entrySize = font->getHeight() + 5;
|
const int entrySize = (int)font->getHeight() + 5;
|
||||||
|
|
||||||
int startEntry = 0;
|
int startEntry = 0;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
|
||||||
if(mCursor == i)
|
if(mCursor == i)
|
||||||
{
|
{
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
Renderer::drawRect(0, (int)y, (int)mSize.x(), font->getHeight(), mSelectorColor);
|
Renderer::drawRect(0, (int)y, (int)mSize.x(), (int)font->getHeight(), mSelectorColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename IList<TextListData, T>::Entry& entry = mEntries.at((unsigned int)i);
|
typename IList<TextListData, T>::Entry& entry = mEntries.at((unsigned int)i);
|
||||||
|
|
|
@ -85,11 +85,11 @@ void GuiInputConfig::render(const Eigen::Affine3f& parentTrans)
|
||||||
stream << "PLAYER " << mTargetConfig->getPlayerNum() + 1 << ", press...";
|
stream << "PLAYER " << mTargetConfig->getPlayerNum() + 1 << ", press...";
|
||||||
font->drawText(stream.str(), Eigen::Vector2f(10, 10), 0x000000FF);
|
font->drawText(stream.str(), Eigen::Vector2f(10, 10), 0x000000FF);
|
||||||
|
|
||||||
int y = 14 + font->getHeight();
|
int y = 14 + (int)font->getHeight();
|
||||||
for(int i = 0; i < mCurInputId; i++)
|
for(int i = 0; i < mCurInputId; i++)
|
||||||
{
|
{
|
||||||
font->drawText(inputDispName[i], Eigen::Vector2f(10, y), 0x00CC00FF);
|
font->drawText(inputDispName[i], Eigen::Vector2f(10, y), 0x00CC00FF);
|
||||||
y += font->getHeight() + 5;
|
y += (int)font->getHeight() + 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mCurInputId >= inputCount)
|
if(mCurInputId >= inputCount)
|
||||||
|
|
|
@ -59,7 +59,8 @@ GuiMsgBox::GuiMsgBox(Window* window, const std::string& text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setSize(width, mMsg->getSize().y() + mButtonGrid->getSize().y() + BUTTON_VERT_PADDING);
|
const float msgHeight = std::max(Font::get(FONT_SIZE_LARGE)->getHeight(), mMsg->getSize().y());
|
||||||
|
setSize(width, msgHeight + mButtonGrid->getSize().y() + BUTTON_VERT_PADDING);
|
||||||
|
|
||||||
// center for good measure
|
// center for good measure
|
||||||
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2.0f, (Renderer::getScreenHeight() - mSize.y()) / 2.0f);
|
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2.0f, (Renderer::getScreenHeight() - mSize.y()) / 2.0f);
|
||||||
|
|
|
@ -276,9 +276,9 @@ Eigen::Vector2f Font::sizeText(std::string text) const
|
||||||
return Eigen::Vector2f(highestWidth, y);
|
return Eigen::Vector2f(highestWidth, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Font::getHeight() const
|
float Font::getHeight() const
|
||||||
{
|
{
|
||||||
return (int)(mMaxGlyphHeight * 1.5f * fontScale);
|
return mMaxGlyphHeight * 1.5f * fontScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
|
|
||||||
void drawCenteredText(std::string text, float xOffset, float y, unsigned int color);
|
void drawCenteredText(std::string text, float xOffset, float y, unsigned int color);
|
||||||
|
|
||||||
int getHeight() const;
|
float getHeight() const;
|
||||||
|
|
||||||
void unload(std::shared_ptr<ResourceManager>& rm) override;
|
void unload(std::shared_ptr<ResourceManager>& rm) override;
|
||||||
void reload(std::shared_ptr<ResourceManager>& rm) override;
|
void reload(std::shared_ptr<ResourceManager>& rm) override;
|
||||||
|
|
Loading…
Reference in a new issue