mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-18 07:41:45 +00:00
Add SDL_RenderSetVSync()
Currently, if an application wants to toggle VSync, they'd have to tear down the renderer and recreate it. This patch fixes that by letting applications call SDL_RenderSetVSync(). This is the same as the patch in #3673, except it applies to all renderers (including PSP, even thought it seems that the VSync flag is disabled for that renderer). Furthermore, the renderer flags also change as well, which #3673 didn't do. It is also an API instead of using hint callbacks (which could be potentially dangerous). Closes #3673.
This commit is contained in:
@@ -4124,4 +4124,15 @@ SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode)
|
||||
return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_RenderSetVSync(SDL_Renderer * renderer, int vsync)
|
||||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (renderer->SetVSync) {
|
||||
return renderer->SetVSync(renderer, vsync);
|
||||
}
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user