Fixed some issues where bundled SVG images would not get cached at the correct resolution.

This commit is contained in:
Leon Styhre 2022-08-30 20:26:48 +02:00
parent eced44934e
commit ed69e46b42
11 changed files with 17 additions and 17 deletions

View file

@ -278,9 +278,9 @@ void MediaViewer::showImage(int index)
if (!mImageFiles.empty() && static_cast<int>(mImageFiles.size()) >= index) {
mImage = new ImageComponent(false, false);
mImage->setImage(mImageFiles[index]);
mImage->setOrigin(0.5f, 0.5f);
mImage->setPosition(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.0f);
mImage->setMaxSize(Renderer::getScreenWidth(), Renderer::getScreenHeight());
mImage->setImage(mImageFiles[index]);
}
}

View file

@ -165,9 +165,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
auto themeCollection = std::make_shared<TextComponent>(
"CREATE NEW CUSTOM COLLECTION FROM THEME", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketThemeCollection = std::make_shared<ImageComponent>();
bracketThemeCollection->setImage(":/graphics/arrow.svg");
bracketThemeCollection->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
bracketThemeCollection->setImage(":/graphics/arrow.svg");
row.addElement(themeCollection, true);
row.addElement(bracketThemeCollection, false);
row.makeAcceptInputHandler([this, unusedFolders] {
@ -198,9 +198,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
auto newCollection = std::make_shared<TextComponent>("CREATE NEW CUSTOM COLLECTION",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketNewCollection = std::make_shared<ImageComponent>();
bracketNewCollection->setImage(":/graphics/arrow.svg");
bracketNewCollection->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
bracketNewCollection->setImage(":/graphics/arrow.svg");
row.addElement(newCollection, true);
row.addElement(bracketNewCollection, false);
auto createCollectionCall = [this](const std::string& newVal) {
@ -234,9 +234,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
auto deleteCollection = std::make_shared<TextComponent>(
"DELETE CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketDeleteCollection = std::make_shared<ImageComponent>();
bracketDeleteCollection->setImage(":/graphics/arrow.svg");
bracketDeleteCollection->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
bracketDeleteCollection->setImage(":/graphics/arrow.svg");
row.addElement(deleteCollection, true);
row.addElement(bracketDeleteCollection, false);
row.makeAcceptInputHandler([this, customSystems] {

View file

@ -112,8 +112,8 @@ void GuiGamelistFilter::addFiltersToMenu()
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
mTextFilterField->setValue(mFilterIndex->getTextFilter());

View file

@ -980,9 +980,9 @@ void GuiMenu::openOtherOptions()
auto media_directory = std::make_shared<TextComponent>("GAME MEDIA DIRECTORY",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketMediaDirectory = std::make_shared<ImageComponent>();
bracketMediaDirectory->setImage(":/graphics/arrow.svg");
bracketMediaDirectory->setResize(
glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
bracketMediaDirectory->setImage(":/graphics/arrow.svg");
rowMediaDir.addElement(media_directory, true);
rowMediaDir.addElement(bracketMediaDirectory, false);
std::string titleMediaDir = "ENTER GAME MEDIA DIRECTORY";

View file

@ -197,8 +197,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
const std::string title {it->displayPrompt};
@ -279,8 +279,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
const std::string title {it->displayPrompt};
@ -415,8 +415,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
const std::string title {it->displayPrompt};
@ -521,8 +521,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
bool multiLine {it->type == MD_MULTILINE_STRING};

View file

@ -169,8 +169,8 @@ void GuiSettings::addEditableTextComponent(const std::string label,
row.addElement(spacer, false);
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()});
bracket->setImage(":/graphics/arrow.svg");
row.addElement(bracket, false);
// OK callback (apply new value to ed).

View file

@ -186,7 +186,7 @@ std::shared_ptr<ComponentGrid> makeButtonGrid(
std::shared_ptr<ImageComponent> makeArrow()
{
auto bracket = std::make_shared<ImageComponent>();
bracket->setImage(":/graphics/arrow.svg");
bracket->setResize(0, std::round(Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()));
bracket->setImage(":/graphics/arrow.svg");
return bracket;
}

View file

@ -460,8 +460,8 @@ private:
if (mParent->mMultiSelect) {
// Add checkbox.
auto checkbox = std::make_shared<ImageComponent>();
checkbox->setImage(it->selected ? CHECKED_PATH : UNCHECKED_PATH);
checkbox->setResize(0, font->getLetterHeight());
checkbox->setImage(it->selected ? CHECKED_PATH : UNCHECKED_PATH);
row.addElement(checkbox, false);
if (mParent->mMultiExclusiveSelect && hasSelectedRow && !(*it).selected)

View file

@ -16,8 +16,8 @@ SwitchComponent::SwitchComponent(bool state)
, mColorOriginalValue {DEFAULT_COLORSHIFT}
, mColorChangedValue {DEFAULT_COLORSHIFT}
{
mImage.setImage(":/graphics/off.svg");
mImage.setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight());
mImage.setImage(":/graphics/off.svg");
mSize = mImage.getSize();
}
@ -68,8 +68,8 @@ void SwitchComponent::setValue(const std::string& statestring)
void SwitchComponent::onStateChanged()
{
mImage.setImage(mState ? ":/graphics/on.svg" : ":/graphics/off.svg");
mImage.setResize(mSize);
mImage.setImage(mState ? ":/graphics/on.svg" : ":/graphics/off.svg");
// Change the color of the switch to reflect the changes.
if (mState == mOriginalValue)

View file

@ -306,8 +306,8 @@ void CarouselComponent<T>::updateEntry(Entry& entry, const std::shared_ptr<Theme
if (entry.data.itemPath != "") {
auto item = std::make_shared<ImageComponent>(false, true);
item->setLinearInterpolation(mLinearInterpolation);
item->setImage(entry.data.itemPath);
item->setMaxSize(mItemSize * mItemScale);
item->setImage(entry.data.itemPath);
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
item->setRotateByTargetSize(true);
entry.data.item = item;

View file

@ -84,9 +84,9 @@ GuiInputConfig::GuiInputConfig(InputConfig* target,
// Icon.
auto icon = std::make_shared<ImageComponent>();
icon->setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 1.25f);
icon->setImage(sGuiInputConfigList[i].icon);
icon->setColorShift(0x777777FF);
icon->setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 1.25f);
row.addElement(icon, false);
// Spacer between icon and text.