mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Fixed incorrect star texture path.
RatingComponent now rasterizes SVGs to the ideal size. TextComponent's text is now vertically centered always.
This commit is contained in:
parent
2aa72928e5
commit
ec4ee70259
|
@ -69,7 +69,7 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char * d
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG(LogError) << "Error - File type unknown/unsupported!";
|
||||
LOG(LogError) << "Error - File type " << (format == FIF_UNKNOWN ? "unknown" : "unsupported") << "!";
|
||||
}
|
||||
//free FIMEMORY again
|
||||
FreeImage_CloseMemory(fiMemory);
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#include "../Renderer.h"
|
||||
#include "../Window.h"
|
||||
#include "../Util.h"
|
||||
#include "../resources/SVGResource.h"
|
||||
|
||||
RatingComponent::RatingComponent(Window* window) : GuiComponent(window)
|
||||
{
|
||||
mFilledTexture = TextureResource::get(":/star_filled.png", true);
|
||||
mUnfilledTexture = TextureResource::get(":/star_unfilled.png", true);
|
||||
mFilledTexture = TextureResource::get(":/star_filled.svg", true);
|
||||
mUnfilledTexture = TextureResource::get(":/star_unfilled.svg", true);
|
||||
mValue = 0.5f;
|
||||
mSize << 64 * 5.0f, 64;
|
||||
updateVertices();
|
||||
|
@ -40,6 +41,15 @@ void RatingComponent::onSizeChanged()
|
|||
else if(mSize.x() == 0)
|
||||
mSize[0] = mSize.y() * 5.0f;
|
||||
|
||||
auto filledSVG = dynamic_cast<SVGResource*>(mFilledTexture.get());
|
||||
auto unfilledSVG = dynamic_cast<SVGResource*>(mUnfilledTexture.get());
|
||||
|
||||
size_t sz = (size_t)round(mSize.y());
|
||||
if(filledSVG)
|
||||
filledSVG->rasterizeAt(sz, sz);
|
||||
if(unfilledSVG)
|
||||
unfilledSVG->rasterizeAt(sz, sz);
|
||||
|
||||
updateVertices();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
|||
|
||||
Eigen::Vector3f dim(mSize.x(), mSize.y(), 0);
|
||||
dim = trans * dim - trans.translation();
|
||||
//Renderer::pushClipRect(Eigen::Vector2i((int)trans.translation().x(), (int)trans.translation().y()),
|
||||
// Eigen::Vector2i((int)(dim.x() + 0.5f), (int)(dim.y() + 0.5f)));
|
||||
Renderer::pushClipRect(Eigen::Vector2i((int)trans.translation().x(), (int)trans.translation().y()),
|
||||
Eigen::Vector2i((int)(dim.x() + 0.5f), (int)(dim.y() + 0.5f)));
|
||||
|
||||
if(mTextCache)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
|||
mFont->renderTextCache(mTextCache.get());
|
||||
}
|
||||
|
||||
//Renderer::popClipRect();
|
||||
Renderer::popClipRect();
|
||||
}
|
||||
|
||||
void TextComponent::calculateExtent()
|
||||
|
|
|
@ -41,7 +41,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
{
|
||||
ed = std::make_shared<RatingComponent>(window);
|
||||
ed->setSize(0, lbl->getSize().y());
|
||||
row.addElement(ed, false, false);
|
||||
row.addElement(ed, false, true);
|
||||
mMenu.addRow(row);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void TextureResource::initFromMemory(const char* data, size_t length)
|
|||
|
||||
if(imageRGBA.size() == 0)
|
||||
{
|
||||
LOG(LogError) << "Could not initialize texture from memory (invalid data)!";
|
||||
LOG(LogError) << "Could not initialize texture from memory, invalid data! (" << mPath << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue