diff --git a/src/components/HelpComponent.cpp b/src/components/HelpComponent.cpp index 7fa9a3ddd..1b9c4dbbc 100644 --- a/src/components/HelpComponent.cpp +++ b/src/components/HelpComponent.cpp @@ -63,12 +63,12 @@ void HelpComponent::updateGrid() std::vector< std::shared_ptr > labels; float width = 0; - const float height = font->getHeight(); + const float height = font->getLetterHeight(); for(auto it = mPrompts.begin(); it != mPrompts.end(); it++) { auto icon = std::make_shared(mWindow); icon->setImage(getIconTexture(it->first)); - icon->setResize(0, height * 0.8f); + icon->setResize(0, height); icons.push_back(icon); auto lbl = std::make_shared(mWindow, strToUpper(it->second), font, 0x777777FF); diff --git a/src/components/ImageComponent.cpp b/src/components/ImageComponent.cpp index c202f3578..9f82bed82 100644 --- a/src/components/ImageComponent.cpp +++ b/src/components/ImageComponent.cpp @@ -149,22 +149,28 @@ void ImageComponent::render(const Eigen::Affine3f& parentTrans) if(mTexture && getOpacity() > 0) { - GLfloat points[12], texs[12]; - GLubyte colors[6*4]; - - if(mTexture->isTiled()) + if(mTexture->isInitialized()) { - float xCount = mSize.x() / getTextureSize().x(); - float yCount = mSize.y() / getTextureSize().y(); - - Renderer::buildGLColorArray(colors, (mColorShift >> 8 << 8)| (getOpacity()), 6); - buildImageArray(0, 0, points, texs, xCount, yCount); - }else{ - Renderer::buildGLColorArray(colors, (mColorShift >> 8 << 8) | (getOpacity()), 6); - buildImageArray(0, 0, points, texs); - } + GLfloat points[12], texs[12]; + GLubyte colors[6*4]; - drawImageArray(points, texs, colors, 6); + if(mTexture->isTiled()) + { + float xCount = mSize.x() / getTextureSize().x(); + float yCount = mSize.y() / getTextureSize().y(); + + Renderer::buildGLColorArray(colors, (mColorShift >> 8 << 8)| (getOpacity()), 6); + buildImageArray(0, 0, points, texs, xCount, yCount); + }else{ + Renderer::buildGLColorArray(colors, (mColorShift >> 8 << 8) | (getOpacity()), 6); + buildImageArray(0, 0, points, texs); + } + + drawImageArray(points, texs, colors, 6); + }else{ + LOG(LogError) << "Image texture is not initialized!"; + mTexture.reset(); + } } GuiComponent::renderChildren(trans); diff --git a/src/components/ScraperSearchComponent.cpp b/src/components/ScraperSearchComponent.cpp index e7dcd0199..ccfb60965 100644 --- a/src/components/ScraperSearchComponent.cpp +++ b/src/components/ScraperSearchComponent.cpp @@ -233,25 +233,26 @@ void ScraperSearchComponent::updateInfoPane() int i = getSelectedIndex(); if(i != -1 && (int)mScraperResults.size() > i) { - mResultName->setText(mScraperResults.at(i).mdl.get("name")); - mResultDesc->setText(mScraperResults.at(i).mdl.get("desc")); + ScraperSearchResult& res = mScraperResults.at(i); + mResultName->setText(res.mdl.get("name")); + mResultDesc->setText(res.mdl.get("desc")); mDescContainer->setScrollPos(Eigen::Vector2d(0, 0)); mDescContainer->resetAutoScrollTimer(); mResultThumbnail->setImage(""); - const std::string& thumb = mScraperResults.at(i).thumbnailUrl; + const std::string& thumb = res.thumbnailUrl.empty() ? res.imageUrl : res.thumbnailUrl; if(!thumb.empty()) mThumbnailReq = std::unique_ptr(new HttpReq(thumb)); else mThumbnailReq.reset(); // metadata - mMD_Rating->setValue(strToUpper(mScraperResults.at(i).mdl.get("rating"))); - mMD_ReleaseDate->setValue(strToUpper(mScraperResults.at(i).mdl.get("releasedate"))); - mMD_Developer->setText(strToUpper(mScraperResults.at(i).mdl.get("developer"))); - mMD_Publisher->setText(strToUpper(mScraperResults.at(i).mdl.get("publisher"))); - mMD_Genre->setText(strToUpper(mScraperResults.at(i).mdl.get("genre"))); - mMD_Players->setText(strToUpper(mScraperResults.at(i).mdl.get("players"))); + mMD_Rating->setValue(strToUpper(res.mdl.get("rating"))); + mMD_ReleaseDate->setValue(strToUpper(res.mdl.get("releasedate"))); + mMD_Developer->setText(strToUpper(res.mdl.get("developer"))); + mMD_Publisher->setText(strToUpper(res.mdl.get("publisher"))); + mMD_Genre->setText(strToUpper(res.mdl.get("genre"))); + mMD_Players->setText(strToUpper(res.mdl.get("players"))); }else{ mResultName->setText(""); diff --git a/src/guis/GuiDetectDevice.cpp b/src/guis/GuiDetectDevice.cpp index 0a3123334..1bcb09db5 100644 --- a/src/guis/GuiDetectDevice.cpp +++ b/src/guis/GuiDetectDevice.cpp @@ -47,9 +47,9 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w mGrid.setEntry(mDeviceInfo, Vector2i(0, 1), false, true); // message - mMsg1 = std::make_shared(mWindow, "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER); + mMsg1 = std::make_shared(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); - mMsg2 = std::make_shared(mWindow, "PRESS F4 TO QUIT AT ANY TIME", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER); + mMsg2 = std::make_shared(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); // currently held device diff --git a/src/resources/TextureResource.cpp b/src/resources/TextureResource.cpp index bd88248c0..4965da6a5 100644 --- a/src/resources/TextureResource.cpp +++ b/src/resources/TextureResource.cpp @@ -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! (" << mPath << ")"; + LOG(LogError) << "Could not initialize texture from memory, invalid data! (file path: " << mPath << ", data ptr: " << (size_t)data << ", reported size: " << length << ")"; return; } @@ -137,3 +137,8 @@ std::shared_ptr TextureResource::get(const std::string& path, b tex->reload(ResourceManager::getInstance()); return tex; } + +bool TextureResource::isInitialized() const +{ + return mTextureID != 0; +} diff --git a/src/resources/TextureResource.h b/src/resources/TextureResource.h index 4c3893e0a..4617ace9e 100644 --- a/src/resources/TextureResource.h +++ b/src/resources/TextureResource.h @@ -19,6 +19,7 @@ public: virtual void unload(std::shared_ptr& rm) override; virtual void reload(std::shared_ptr& rm) override; + bool isInitialized() const; bool isTiled() const; const Eigen::Vector2i& getSize() const; void bind() const;