mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 12:05:39 +00:00
Fixed some menu alignment issues.
This commit is contained in:
parent
311595ff62
commit
1bbf32a6f5
|
@ -290,16 +290,16 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
||||||
dim.x = (trans[0].x * dim.x + trans[3].x) - trans[3].x;
|
dim.x = (trans[0].x * dim.x + trans[3].x) - trans[3].x;
|
||||||
dim.y = (trans[1].y * dim.y + trans[3].y) - trans[3].y;
|
dim.y = (trans[1].y * dim.y + trans[3].y) - trans[3].y;
|
||||||
|
|
||||||
const int clipRectPosX {static_cast<int>(std::round(trans[3].x))};
|
const int clipRectPosX {static_cast<int>(std::ceil(trans[3].x))};
|
||||||
const int clipRectPosY {static_cast<int>(std::round(trans[3].y))};
|
const int clipRectPosY {static_cast<int>(std::ceil(trans[3].y))};
|
||||||
const int clipRectSizeX {static_cast<int>(std::round(dim.x))};
|
const int clipRectSizeX {static_cast<int>(std::ceil(dim.x))};
|
||||||
const int clipRectSizeY {static_cast<int>(std::round(dim.y))};
|
const int clipRectSizeY {static_cast<int>(std::ceil(dim.y))};
|
||||||
|
|
||||||
mRenderer->pushClipRect(glm::ivec2 {clipRectPosX, clipRectPosY},
|
mRenderer->pushClipRect(glm::ivec2 {clipRectPosX, clipRectPosY},
|
||||||
glm::ivec2 {clipRectSizeX, clipRectSizeY});
|
glm::ivec2 {clipRectSizeX, clipRectSizeY});
|
||||||
|
|
||||||
// Scroll the camera.
|
// Scroll the camera.
|
||||||
trans = glm::translate(trans, glm::vec3 {0.0f, -mCameraOffset, 0.0f});
|
trans = glm::translate(trans, glm::vec3 {0.0f, std::round(-mCameraOffset), 0.0f});
|
||||||
|
|
||||||
glm::mat4 loopTrans {trans};
|
glm::mat4 loopTrans {trans};
|
||||||
|
|
||||||
|
@ -382,12 +382,12 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
||||||
const float selectedRowHeight = getRowHeight(mEntries.at(mCursor).data);
|
const float selectedRowHeight = getRowHeight(mEntries.at(mCursor).data);
|
||||||
|
|
||||||
if (mOpacity == 1.0f) {
|
if (mOpacity == 1.0f) {
|
||||||
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::ceil(mSize.x), selectedRowHeight,
|
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::round(mSize.x), selectedRowHeight,
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, false, mOpacity, mDimming,
|
0xFFFFFFFF, 0xFFFFFFFF, false, mOpacity, mDimming,
|
||||||
Renderer::BlendFactor::ONE_MINUS_DST_COLOR,
|
Renderer::BlendFactor::ONE_MINUS_DST_COLOR,
|
||||||
Renderer::BlendFactor::ZERO);
|
Renderer::BlendFactor::ZERO);
|
||||||
|
|
||||||
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::ceil(mSize.x), selectedRowHeight,
|
mRenderer->drawRect(0.0f, mSelectorBarOffset, std::round(mSize.x), selectedRowHeight,
|
||||||
0x777777FF, 0x777777FF, false, mOpacity, mDimming,
|
0x777777FF, 0x777777FF, false, mOpacity, mDimming,
|
||||||
Renderer::BlendFactor::ONE, Renderer::BlendFactor::ONE);
|
Renderer::BlendFactor::ONE, Renderer::BlendFactor::ONE);
|
||||||
}
|
}
|
||||||
|
@ -403,12 +403,13 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
||||||
// Draw separators.
|
// Draw separators.
|
||||||
float y = 0;
|
float y = 0;
|
||||||
for (unsigned int i = 0; i < mEntries.size(); ++i) {
|
for (unsigned int i = 0; i < mEntries.size(); ++i) {
|
||||||
mRenderer->drawRect(0.0f, y, std::ceil(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
mRenderer->drawRect(0.0f, y, std::round(mSize.x),
|
||||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
1.0f * Renderer::getScreenHeightModifier(), 0xC6C7C6FF, 0xC6C7C6FF,
|
||||||
|
false, mOpacity, mDimming);
|
||||||
y += getRowHeight(mEntries.at(i).data);
|
y += getRowHeight(mEntries.at(i).data);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRenderer->drawRect(0.0f, y, std::ceil(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
mRenderer->drawRect(0.0f, y, std::round(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
||||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
||||||
mRenderer->popClipRect();
|
mRenderer->popClipRect();
|
||||||
}
|
}
|
||||||
|
@ -448,7 +449,7 @@ void ComponentList::updateElementPosition(const ComponentListRow& row)
|
||||||
const auto comp = row.elements.at(i).component;
|
const auto comp = row.elements.at(i).component;
|
||||||
|
|
||||||
// Center vertically.
|
// Center vertically.
|
||||||
comp->setPosition(x, (rowHeight - std::round(comp->getSize().y)) / 2.0f + yOffset);
|
comp->setPosition(x, (rowHeight - std::floor(comp->getSize().y)) / 2.0f + yOffset);
|
||||||
x += comp->getSize().x;
|
x += comp->getSize().x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue