mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +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:
@@ -1694,6 +1694,15 @@ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
|
||||
|
||||
/**
|
||||
* Toggle VSync of the given renderer.
|
||||
*
|
||||
* \param renderer The renderer to toggle
|
||||
* \param vsync Non-zero for on, zero for off
|
||||
* \returns a 0 int on success, or non-zero on failure
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderSetVSync(SDL_Renderer* renderer, int vsync);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user