Removed a lot of unnecessary NinePatchComponent::fitTo() function arguments

This commit is contained in:
Leon Styhre 2023-04-30 16:49:51 +02:00
parent a7f84b7404
commit 8bc31e2fd8
16 changed files with 18 additions and 17 deletions

View file

@ -192,7 +192,7 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
// Center on the X axis and keep slightly off-center on the Y axis.
setPosition(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.25f);
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
mBackground.setEdgeColor(0xEEEEEEFF);
}

View file

@ -733,7 +733,7 @@ void GuiMetaDataEd::onSizeChanged()
mGrid.setColWidthPerc(1, 0.055f);
mGrid.setSize(mSize);
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
setPosition((mRenderer->getScreenWidth() - mSize.x) / 2.0f,
(mRenderer->getScreenHeight() - mSize.y) / 2.0f);

View file

@ -201,7 +201,7 @@ GuiOfflineGenerator::~GuiOfflineGenerator()
void GuiOfflineGenerator::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
// Set row heights.
mGrid.setRowHeightPerc(0, mTitle->getFont()->getLetterHeight() * 1.9725f / mSize.y, false);

View file

@ -203,7 +203,7 @@ void GuiScraperMulti::onSizeChanged()
mGrid.setColWidthPerc(1, 0.04f);
mGrid.setSize(mSize);
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
}
void GuiScraperMulti::doNextSearch()

View file

@ -158,7 +158,7 @@ void GuiScraperSingle::onSizeChanged()
mGrid.setColWidthPerc(1, 0.04f);
mGrid.setSize(glm::round(mSize));
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
// Add some extra margins to the game name.
const float newSizeX {mSize.x * 0.96f};

View file

@ -1089,7 +1089,7 @@ void GuiThemeDownloader::onSizeChanged()
mGrid.setSize(mSize);
mCenterGrid->setSize(glm::vec2 {mSize.x, mSize.y});
mCenterGrid->setPosition(glm::vec3 {0.0f, mGrid.getRowHeight(0) + mGrid.getRowHeight(1), 0.0f});
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
mScreenshot->setMaxSize(mCenterGrid->getColWidth(1) + mCenterGrid->getColWidth(2) +
mCenterGrid->getColWidth(3) + mCenterGrid->getColWidth(4),
mCenterGrid->getRowHeight(3));

View file

@ -58,7 +58,7 @@ void BusyComponent::onSizeChanged()
16.0f * Renderer::getScreenResolutionModifier()});
mBackground.fitTo(glm::vec2 {mGrid.getColWidth(1) + mGrid.getColWidth(2) + mGrid.getColWidth(3),
textHeight + (2.0f * Renderer::getScreenResolutionModifier())},
mAnimation->getPosition(), glm::vec2 {});
mAnimation->getPosition(), glm::vec2 {0.0f, 0.0f});
mAnimation->load(&BUSY_ANIMATION_DEF);
}

View file

@ -121,7 +121,7 @@ void MenuComponent::updateSize()
void MenuComponent::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
// Update grid row/column sizes.
mGrid.setRowHeightPerc(0, TITLE_HEIGHT / mSize.y / 2.0f);

View file

@ -37,7 +37,9 @@ public:
void render(const glm::mat4& parentTrans) override;
void onSizeChanged() override { buildVertices(); }
void fitTo(glm::vec2 size, glm::vec3 position = {}, glm::vec2 padding = {});
void fitTo(glm::vec2 size,
glm::vec3 position = {0.0f, 0.0f, 0.0f},
glm::vec2 padding = {-32.0f, -32.0f});
void setImagePath(const std::string& path);
// Apply a color shift to the "edge" parts of the ninepatch.

View file

@ -56,7 +56,7 @@ void TextEditComponent::onSizeChanged()
return;
mBox.fitTo(
mSize, glm::vec3 {},
mSize, glm::vec3 {0.0f, 0.0f, 0.0f},
glm::vec2 {-34.0f, -32.0f - (TEXT_PADDING_VERT * mRenderer->getScreenHeightModifier())});
onTextChanged(); // Wrap point probably changed.
}

View file

@ -94,9 +94,8 @@ GuiDetectDevice::GuiDetectDevice(bool firstRun,
void GuiDetectDevice::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
// Grid.
mGrid.setSize(mSize);
mGrid.setRowHeightPerc(0, mTitle->getFont()->getHeight() / mSize.y);
mGrid.setRowHeightPerc(2, mMsg1->getFont()->getHeight() / mSize.y);

View file

@ -55,7 +55,7 @@ GuiInfoPopup::GuiInfoPopup(std::string message, int duration)
setPosition(posX, posY, 0);
mFrame->setImagePath(":/graphics/frame.svg");
mFrame->fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mFrame->fitTo(mSize);
addChild(mFrame);
// We only initialize the actual time when we first start to render.

View file

@ -306,7 +306,7 @@ void GuiInputConfig::update(int deltaTime)
void GuiInputConfig::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
// Update grid.
mGrid.setSize(mSize);

View file

@ -174,7 +174,7 @@ void GuiMsgBox::onSizeChanged()
mGrid.getRowHeight(0));
mGrid.onSizeChanged();
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
}
void GuiMsgBox::deleteMeAndCall(const std::function<void()>& func)

View file

@ -304,7 +304,7 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
void GuiTextEditKeyboardPopup::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
mText->setSize(mSize.x - KEYBOARD_PADDINGX - KEYBOARD_PADDINGX, mText->getSize().y);
// Update grid.

View file

@ -135,7 +135,7 @@ GuiTextEditPopup::GuiTextEditPopup(const HelpStyle& helpstyle,
void GuiTextEditPopup::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize);
mText->setSize(mSize.x - 40.0f * Renderer::getScreenHeightModifier(), mText->getSize().y);
// Update grid.