Avoid while loop for calculating console Y offset

This commit is contained in:
Robert Müller 2023-12-19 22:09:48 +01:00
parent bb650b85c4
commit 0da1743143

View file

@ -1147,9 +1147,7 @@ void CGameConsole::OnRender()
const float XScale = Graphics()->ScreenWidth() / Screen.w;
const float YScale = Graphics()->ScreenHeight() / Screen.h;
float CalcOffsetY = 0;
while(y - (CalcOffsetY + LineHeight) > RowHeight)
CalcOffsetY += LineHeight;
const float CalcOffsetY = LineHeight * std::floor((y - RowHeight) / LineHeight);
const float ClipStartY = (y - CalcOffsetY) * YScale;
Graphics()->ClipEnable(0, ClipStartY, Screen.w * XScale, y * YScale - ClipStartY);