Fixed an issue where separator lines would not get rendered on lower resolutions.

This commit is contained in:
Leon Styhre 2021-01-16 22:55:38 +01:00
parent 9589778107
commit ef25c675f7
2 changed files with 16 additions and 6 deletions

View file

@ -208,7 +208,7 @@ void ComponentGrid::updateSeparators()
std::vector<float> coordVector;
coordVector.push_back(pos.x());
coordVector.push_back(pos.y());
coordVector.push_back(1.0f * Renderer::getScreenHeightModifier());
coordVector.push_back(1.0f * Renderer::getScreenWidthModifier());
coordVector.push_back(size.y());
mSeparators.push_back(coordVector);
}
@ -216,7 +216,7 @@ void ComponentGrid::updateSeparators()
std::vector<float> coordVector;
coordVector.push_back(pos.x() + size.x());
coordVector.push_back(pos.y());
coordVector.push_back(1.0f * Renderer::getScreenHeightModifier());
coordVector.push_back(1.0f * Renderer::getScreenWidthModifier());
coordVector.push_back(size.y());
mSeparators.push_back(coordVector);
}

View file

@ -364,10 +364,20 @@ namespace Renderer
const unsigned int colorEnd = convertRGBAToABGR(_colorEnd);
Vertex vertices[4];
vertices[0] = { { _x ,_y }, { 0.0f, 0.0f }, color };
vertices[1] = { { _x ,_y + _h }, { 0.0f, 0.0f }, horizontalGradient ? colorEnd : color };
vertices[2] = { { _x + _w,_y }, { 0.0f, 0.0f }, horizontalGradient ? color : colorEnd };
vertices[3] = { { _x + _w,_y + _h }, { 0.0f, 0.0f }, colorEnd };
float _wL = _w;
float _hL = _h;
// If the width or height was scaled down to less than 1 pixel, then set it to
// 1 pixel so that it will still render on lower resolutions.
if (_wL > 0 && _wL < 1)
_wL = 1;
if (_hL > 0 && _hL < 1)
_hL = 1;
vertices[0] = { { _x , _y }, { 0.0f, 0.0f }, color };
vertices[1] = { { _x , _y + _hL }, { 0.0f, 0.0f }, horizontalGradient ? colorEnd : color };
vertices[2] = { { _x + _wL, _y }, { 0.0f, 0.0f }, horizontalGradient ? color : colorEnd };
vertices[3] = { { _x + _wL, _y + _hL }, { 0.0f, 0.0f }, colorEnd };
// Round vertices.
for (int i = 0; i < 4; ++i)