mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-03 13:35:32 +02:00
Graphics.transition average FPS bugfix
Move average FPS update logic into new function updateAvgFPS() Call this during Graphics.transition so that the FPS counter does not erroneously drop
This commit is contained in:
parent
52c932b9a0
commit
7a12e6ddcf
1 changed files with 14 additions and 8 deletions
|
@ -1083,14 +1083,7 @@ struct GraphicsPrivate {
|
|||
|
||||
swapGLBuffer();
|
||||
|
||||
SDL_LockMutex(avgFPSLock);
|
||||
if (avgFPSData.size() > 40)
|
||||
avgFPSData.erase(avgFPSData.begin());
|
||||
|
||||
double time = shState->runTime();
|
||||
avgFPSData.push_back(time - last_avg_update);
|
||||
last_avg_update = time;
|
||||
SDL_UnlockMutex(avgFPSLock);
|
||||
updateAvgFPS();
|
||||
}
|
||||
|
||||
void checkSyncLock() {
|
||||
|
@ -1130,6 +1123,17 @@ struct GraphicsPrivate {
|
|||
|
||||
SDL_UnlockMutex(glResourceLock);
|
||||
}
|
||||
|
||||
void updateAvgFPS() {
|
||||
SDL_LockMutex(avgFPSLock);
|
||||
if (avgFPSData.size() > 40)
|
||||
avgFPSData.erase(avgFPSData.begin());
|
||||
|
||||
double time = shState->runTime();
|
||||
avgFPSData.push_back(time - last_avg_update);
|
||||
last_avg_update = time;
|
||||
SDL_UnlockMutex(avgFPSLock);
|
||||
}
|
||||
};
|
||||
|
||||
Graphics::Graphics(RGSSThreadData *data) {
|
||||
|
@ -1309,6 +1313,8 @@ void Graphics::transition(int duration, const char *filename, int vague) {
|
|||
GLMeta::blitEnd();
|
||||
|
||||
p->swapGLBuffer();
|
||||
/* Call this manually, as redrawScreen() is not called during this loop. */
|
||||
p->updateAvgFPS();
|
||||
}
|
||||
|
||||
glState.blend.pop();
|
||||
|
|
Loading…
Add table
Reference in a new issue