mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 16:15:39 +00:00
Fixed console spam when an ImageComponent has an invalid texture.
This commit is contained in:
parent
7875c2271c
commit
0464776e62
|
@ -63,12 +63,12 @@ void HelpComponent::updateGrid()
|
||||||
std::vector< std::shared_ptr<TextComponent> > labels;
|
std::vector< std::shared_ptr<TextComponent> > labels;
|
||||||
|
|
||||||
float width = 0;
|
float width = 0;
|
||||||
const float height = font->getHeight();
|
const float height = font->getLetterHeight();
|
||||||
for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
|
for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
|
||||||
{
|
{
|
||||||
auto icon = std::make_shared<ImageComponent>(mWindow);
|
auto icon = std::make_shared<ImageComponent>(mWindow);
|
||||||
icon->setImage(getIconTexture(it->first));
|
icon->setImage(getIconTexture(it->first));
|
||||||
icon->setResize(0, height * 0.8f);
|
icon->setResize(0, height);
|
||||||
icons.push_back(icon);
|
icons.push_back(icon);
|
||||||
|
|
||||||
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(it->second), font, 0x777777FF);
|
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(it->second), font, 0x777777FF);
|
||||||
|
|
|
@ -148,6 +148,8 @@ void ImageComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
|
|
||||||
if(mTexture && getOpacity() > 0)
|
if(mTexture && getOpacity() > 0)
|
||||||
|
{
|
||||||
|
if(mTexture->isInitialized())
|
||||||
{
|
{
|
||||||
GLfloat points[12], texs[12];
|
GLfloat points[12], texs[12];
|
||||||
GLubyte colors[6*4];
|
GLubyte colors[6*4];
|
||||||
|
@ -165,6 +167,10 @@ void ImageComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
}
|
}
|
||||||
|
|
||||||
drawImageArray(points, texs, colors, 6);
|
drawImageArray(points, texs, colors, 6);
|
||||||
|
}else{
|
||||||
|
LOG(LogError) << "Image texture is not initialized!";
|
||||||
|
mTexture.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiComponent::renderChildren(trans);
|
GuiComponent::renderChildren(trans);
|
||||||
|
|
|
@ -233,25 +233,26 @@ void ScraperSearchComponent::updateInfoPane()
|
||||||
int i = getSelectedIndex();
|
int i = getSelectedIndex();
|
||||||
if(i != -1 && (int)mScraperResults.size() > i)
|
if(i != -1 && (int)mScraperResults.size() > i)
|
||||||
{
|
{
|
||||||
mResultName->setText(mScraperResults.at(i).mdl.get("name"));
|
ScraperSearchResult& res = mScraperResults.at(i);
|
||||||
mResultDesc->setText(mScraperResults.at(i).mdl.get("desc"));
|
mResultName->setText(res.mdl.get("name"));
|
||||||
|
mResultDesc->setText(res.mdl.get("desc"));
|
||||||
mDescContainer->setScrollPos(Eigen::Vector2d(0, 0));
|
mDescContainer->setScrollPos(Eigen::Vector2d(0, 0));
|
||||||
mDescContainer->resetAutoScrollTimer();
|
mDescContainer->resetAutoScrollTimer();
|
||||||
|
|
||||||
mResultThumbnail->setImage("");
|
mResultThumbnail->setImage("");
|
||||||
const std::string& thumb = mScraperResults.at(i).thumbnailUrl;
|
const std::string& thumb = res.thumbnailUrl.empty() ? res.imageUrl : res.thumbnailUrl;
|
||||||
if(!thumb.empty())
|
if(!thumb.empty())
|
||||||
mThumbnailReq = std::unique_ptr<HttpReq>(new HttpReq(thumb));
|
mThumbnailReq = std::unique_ptr<HttpReq>(new HttpReq(thumb));
|
||||||
else
|
else
|
||||||
mThumbnailReq.reset();
|
mThumbnailReq.reset();
|
||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
mMD_Rating->setValue(strToUpper(mScraperResults.at(i).mdl.get("rating")));
|
mMD_Rating->setValue(strToUpper(res.mdl.get("rating")));
|
||||||
mMD_ReleaseDate->setValue(strToUpper(mScraperResults.at(i).mdl.get("releasedate")));
|
mMD_ReleaseDate->setValue(strToUpper(res.mdl.get("releasedate")));
|
||||||
mMD_Developer->setText(strToUpper(mScraperResults.at(i).mdl.get("developer")));
|
mMD_Developer->setText(strToUpper(res.mdl.get("developer")));
|
||||||
mMD_Publisher->setText(strToUpper(mScraperResults.at(i).mdl.get("publisher")));
|
mMD_Publisher->setText(strToUpper(res.mdl.get("publisher")));
|
||||||
mMD_Genre->setText(strToUpper(mScraperResults.at(i).mdl.get("genre")));
|
mMD_Genre->setText(strToUpper(res.mdl.get("genre")));
|
||||||
mMD_Players->setText(strToUpper(mScraperResults.at(i).mdl.get("players")));
|
mMD_Players->setText(strToUpper(res.mdl.get("players")));
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
mResultName->setText("");
|
mResultName->setText("");
|
||||||
|
|
|
@ -47,9 +47,9 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w
|
||||||
mGrid.setEntry(mDeviceInfo, Vector2i(0, 1), false, true);
|
mGrid.setEntry(mDeviceInfo, Vector2i(0, 1), false, true);
|
||||||
|
|
||||||
// message
|
// message
|
||||||
mMsg1 = std::make_shared<TextComponent>(mWindow, "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
mMsg1 = std::make_shared<TextComponent>(mWindow, "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT.", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mMsg1, Vector2i(0, 2), false, true);
|
mGrid.setEntry(mMsg1, Vector2i(0, 2), false, true);
|
||||||
mMsg2 = std::make_shared<TextComponent>(mWindow, "PRESS F4 TO QUIT AT ANY TIME", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
mMsg2 = std::make_shared<TextComponent>(mWindow, "PRESS F4 TO QUIT AT ANY TIME.", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mMsg2, Vector2i(0, 3), false, true);
|
mGrid.setEntry(mMsg2, Vector2i(0, 3), false, true);
|
||||||
|
|
||||||
// currently held device
|
// currently held device
|
||||||
|
|
|
@ -62,7 +62,7 @@ void TextureResource::initFromMemory(const char* data, size_t length)
|
||||||
|
|
||||||
if(imageRGBA.size() == 0)
|
if(imageRGBA.size() == 0)
|
||||||
{
|
{
|
||||||
LOG(LogError) << "Could not initialize texture from memory, invalid data! (" << mPath << ")";
|
LOG(LogError) << "Could not initialize texture from memory, invalid data! (file path: " << mPath << ", data ptr: " << (size_t)data << ", reported size: " << length << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,3 +137,8 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path, b
|
||||||
tex->reload(ResourceManager::getInstance());
|
tex->reload(ResourceManager::getInstance());
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextureResource::isInitialized() const
|
||||||
|
{
|
||||||
|
return mTextureID != 0;
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
virtual void unload(std::shared_ptr<ResourceManager>& rm) override;
|
virtual void unload(std::shared_ptr<ResourceManager>& rm) override;
|
||||||
virtual void reload(std::shared_ptr<ResourceManager>& rm) override;
|
virtual void reload(std::shared_ptr<ResourceManager>& rm) override;
|
||||||
|
|
||||||
|
bool isInitialized() const;
|
||||||
bool isTiled() const;
|
bool isTiled() const;
|
||||||
const Eigen::Vector2i& getSize() const;
|
const Eigen::Vector2i& getSize() const;
|
||||||
void bind() const;
|
void bind() const;
|
||||||
|
|
Loading…
Reference in a new issue