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:
parent
b2504b5da6
commit
4549769d7d
13 changed files with 168 additions and 0 deletions
|
@ -921,6 +921,14 @@ PSP_DestroyRenderer(SDL_Renderer * renderer)
|
|||
SDL_free(renderer);
|
||||
}
|
||||
|
||||
static int
|
||||
PSP_SetVSync(SDL_Renderer * renderer, const int vsync)
|
||||
{
|
||||
PSP_RenderData *data = renderer->driverdata;
|
||||
data->vsync = vsync;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_Renderer *
|
||||
PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
{
|
||||
|
@ -962,6 +970,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
renderer->RenderPresent = PSP_RenderPresent;
|
||||
renderer->DestroyTexture = PSP_DestroyTexture;
|
||||
renderer->DestroyRenderer = PSP_DestroyRenderer;
|
||||
renderer->SetVSync = PSP_SetVSync;
|
||||
renderer->info = PSP_RenderDriver.info;
|
||||
renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
|
||||
renderer->driverdata = data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue