Add vid_maxfps support for Windows and Linux

This commit is contained in:
Magnus Norddahl 2016-08-22 20:03:08 +02:00 committed by Christoph Oelckers
parent 1594cc9570
commit 276fb7dbb2
2 changed files with 12 additions and 0 deletions

View file

@ -459,6 +459,13 @@ void SDLGLFB::NewRefreshRate ()
void SDLGLFB::SwapBuffers()
{
#ifndef __APPLE__
if (vid_maxfps && !cl_capfps)
{
SEMAPHORE_WAIT(FPSLimitSemaphore)
}
#endif
SDL_GL_SwapWindow (Screen);
}

View file

@ -1149,6 +1149,11 @@ void Win32GLFrameBuffer::SetVSync (bool vsync)
void Win32GLFrameBuffer::SwapBuffers()
{
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
if (FPSLimitEvent != NULL)
{
WaitForSingleObject(FPSLimitEvent, 1000);
}
::SwapBuffers(static_cast<Win32GLVideo *>(Video)->m_hDC);
}