Smoother menu checker background scrolling on loading screens

Update global time also while rendering loading screens and shift the menu checker background based on the global time so it's smoother while loading.
This commit is contained in:
Robert Müller 2024-07-28 14:36:53 +02:00
parent 26b9d16e05
commit 23fb01f9dd
2 changed files with 2 additions and 1 deletions

View file

@ -3820,6 +3820,7 @@ void CClient::UpdateAndSwap()
Input()->Update(); Input()->Update();
Graphics()->Swap(); Graphics()->Swap();
Graphics()->Clear(0, 0, 0); Graphics()->Clear(0, 0, 0);
m_GlobalTime = (time_get() - m_GlobalStartTime) / (float)time_freq();
} }
void CClient::ServerBrowserUpdate() void CClient::ServerBrowserUpdate()

View file

@ -2231,7 +2231,7 @@ void CMenus::RenderBackground()
Graphics()->QuadsBegin(); Graphics()->QuadsBegin();
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.045f); Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.045f);
const float Size = 15.0f; const float Size = 15.0f;
const float OffsetTime = std::fmod(LocalTime() * 0.15f, 2.0f); const float OffsetTime = std::fmod(Client()->GlobalTime() * 0.15f, 2.0f);
IGraphics::CQuadItem aCheckerItems[64]; IGraphics::CQuadItem aCheckerItems[64];
size_t NumCheckerItems = 0; size_t NumCheckerItems = 0;
for(int y = -2; y < (int)(ScreenWidth / Size); y++) for(int y = -2; y < (int)(ScreenWidth / Size); y++)