Removed some unnecessary roundings.

This commit is contained in:
Leon Styhre 2022-10-25 20:39:12 +02:00
parent 18bbd97433
commit c50b6b35f4
3 changed files with 14 additions and 16 deletions

View file

@ -299,7 +299,7 @@ void ComponentList::render(const glm::mat4& parentTrans)
glm::ivec2 {clipRectSizeX, clipRectSizeY});
// Scroll the camera.
trans = glm::translate(trans, glm::vec3 {0.0f, std::round(-mCameraOffset), 0.0f});
trans = glm::translate(trans, glm::vec3 {0.0f, -mCameraOffset, 0.0f});
glm::mat4 loopTrans {trans};
@ -382,14 +382,14 @@ void ComponentList::render(const glm::mat4& parentTrans)
const float selectedRowHeight {getRowHeight(mEntries.at(mCursor).data)};
if (mOpacity == 1.0f) {
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::round(mSize.x), selectedRowHeight,
0xFFFFFFFF, 0xFFFFFFFF, false, mOpacity, mDimming,
mRenderer->drawRect(0.0f, mSelectorBarOffset, mSize.x, selectedRowHeight, 0xFFFFFFFF,
0xFFFFFFFF, false, mOpacity, mDimming,
Renderer::BlendFactor::ONE_MINUS_DST_COLOR,
Renderer::BlendFactor::ZERO);
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::round(mSize.x), selectedRowHeight,
0x777777FF, 0x777777FF, false, mOpacity, mDimming,
Renderer::BlendFactor::ONE, Renderer::BlendFactor::ONE);
mRenderer->drawRect(0.0f, mSelectorBarOffset, mSize.x, selectedRowHeight, 0x777777FF,
0x777777FF, false, mOpacity, mDimming, Renderer::BlendFactor::ONE,
Renderer::BlendFactor::ONE);
}
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); ++it)
@ -403,14 +403,13 @@ void ComponentList::render(const glm::mat4& parentTrans)
// Draw separators.
float y {0.0f};
for (unsigned int i = 0; i < mEntries.size(); ++i) {
mRenderer->drawRect(0.0f, y, std::round(mSize.x),
1.0f * Renderer::getScreenHeightModifier(), 0xC6C7C6FF, 0xC6C7C6FF,
false, mOpacity, mDimming);
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * Renderer::getScreenHeightModifier(),
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
y += getRowHeight(mEntries.at(i).data);
}
mRenderer->drawRect(0.0f, y, std::round(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * Renderer::getScreenHeightModifier(), 0xC6C7C6FF,
0xC6C7C6FF, false, mOpacity, mDimming);
mRenderer->popClipRect();
}

View file

@ -113,7 +113,7 @@ void MenuComponent::updateSize()
void MenuComponent::onSizeChanged()
{
mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f});
mBackground.fitTo(mSize, glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec2 {-32.0f, -32.0f});
// Update grid row/column sizes.
mGrid.setRowHeightPerc(0, TITLE_HEIGHT / mSize.y / 2.0f);
@ -131,7 +131,7 @@ void MenuComponent::onSizeChanged()
mTitle->setSize(titleSize.x - indicatorsSize, titleSize.y);
glm::vec3 titlePos {mTitle->getPosition()};
mTitle->setPosition(titlePos.x + std::round(indicatorsSize / 2.0f), titlePos.y, titlePos.z);
mTitle->setPosition(titlePos.x + indicatorsSize / 2.0f, titlePos.y, titlePos.z);
}
void MenuComponent::addButton(const std::string& name,

View file

@ -60,9 +60,8 @@ void NinePatchComponent::buildVertices()
else {
// Scale the corner size relative to the screen resolution (using the medium sized
// default font as size reference).
relCornerSize =
glm::round(mCornerSize * (Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() *
(mSharpCorners == true ? 0.0568f : 0.09f) / 2.0f));
relCornerSize = mCornerSize * (Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() *
(mSharpCorners == true ? 0.0568f : 0.09f) / 2.0f);
}
glm::vec2 texSize {relCornerSize * 3.0f};