Removed lots of unnecessary help component texture resizing.

This commit is contained in:
Leon Styhre 2021-09-27 21:03:53 +02:00
parent 081fbc5665
commit 87d6207c51
3 changed files with 5 additions and 4 deletions

View file

@ -218,7 +218,7 @@ void HelpComponent::updateGrid()
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) {
auto icon = std::make_shared<ImageComponent>(mWindow);
icon->setImage(getIconTexture(it->first.c_str()));
icon->setImage(getIconTexture(it->first.c_str()), false);
icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor);
icon->setResize(0, height);
icons.push_back(icon);

View file

@ -170,10 +170,11 @@ void ImageComponent::setImage(const char* data, size_t length, bool tile)
resize();
}
void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture)
void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture)
{
mTexture = texture;
resize();
if (resizeTexture)
resize();
}
void ImageComponent::setResize(float width, float height)

View file

@ -28,7 +28,7 @@ public:
// Loads an image from memory.
void setImage(const char* data, size_t length, bool tile = false);
// Use an already existing texture.
void setImage(const std::shared_ptr<TextureResource>& texture);
void setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture = true);
void onSizeChanged() override { updateVertices(); }