mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Avoid using too much performance to update the loading screen, especially on low-end PCs
This commit is contained in:
parent
be5deddc1d
commit
a3050f6c64
1 changed files with 13 additions and 5 deletions
|
@ -136,7 +136,8 @@ static unsigned int startCountHigh;
|
|||
static unsigned int loadCountLow;
|
||||
static unsigned int loadCountHigh;
|
||||
static unsigned int loadCount;
|
||||
static unsigned int lastTime;
|
||||
static unsigned int lastTime = 0;
|
||||
static unsigned int updateTime = 0;
|
||||
static unsigned int loadNumber;
|
||||
static unsigned int totalLoadTime;
|
||||
static unsigned int currentLoadTime;
|
||||
|
@ -5507,12 +5508,19 @@ UI_TestUpdateScreen
|
|||
void UI_TestUpdateScreen(unsigned int timeout)
|
||||
{
|
||||
unsigned int newTime = Sys_Milliseconds();
|
||||
unsigned int startRenderTime, endRenderTime;
|
||||
|
||||
if (newTime - lastTime >= timeout) {
|
||||
lastTime = newTime;
|
||||
Sys_PumpMessageLoop();
|
||||
SCR_UpdateScreen();
|
||||
if (timeout > 0 && (newTime - lastTime) < (timeout + updateTime)) {
|
||||
return;
|
||||
}
|
||||
|
||||
startRenderTime = Sys_Milliseconds();
|
||||
Sys_PumpMessageLoop();
|
||||
SCR_UpdateScreen();
|
||||
endRenderTime = Sys_Milliseconds();
|
||||
|
||||
updateTime = Q_min(endRenderTime - startRenderTime, 1000);
|
||||
lastTime = endRenderTime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue