Add SDL_GetRenderVSync (see #6495) (#6965)

This commit is contained in:
Sylvain Becker 2023-01-02 20:21:02 +01:00 committed by GitHub
parent 023f067903
commit 851b0e16be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 0 deletions

View file

@ -20,3 +20,4 @@ General:
* Added SDL_DelayNS() to specify a delay in nanoseconds, to the highest precision the system will support
* The timestamp member of the SDL_Event structure is now in nanoseconds, filled in with the time the event was generated, or the time it was queued if that's not available
* Added SDL_modf() and SDL_modff() to separate the whole and fractional portions of a floating point number
* Added SDL_GetRenderVSync() to get vsync of the given renderer

View file

@ -1925,6 +1925,17 @@ extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer * re
*/
extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer* renderer, int vsync);
/**
* Get VSync of the given renderer.
*
* \param renderer The renderer to toggle
* \param set output vsync 1 for on, 0 for off. All other values are reserved
* \returns a 0 int on success, or non-zero on failure
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View file

@ -856,6 +856,7 @@ SDL3_0.0.0 {
SDL_wcsstr;
SDL_modf;
SDL_modff;
SDL_GetRenderVSync;
# extra symbols go here (don't modify this line)
local: *;
};

View file

@ -884,3 +884,4 @@
/* New API symbols are added at the end */
#define SDL_modf SDL_modf_REAL
#define SDL_modff SDL_modff_REAL
#define SDL_GetRenderVSync SDL_GetRenderVSync_REAL

View file

@ -929,3 +929,4 @@ SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),r
/* New API symbols are added at the end */
SDL_DYNAPI_PROC(double,SDL_modf,(double a, double *b),(a,b),return)
SDL_DYNAPI_PROC(float,SDL_modff,(float a, float *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetRenderVSync,(SDL_Renderer *a, int *b),(a,b),return)

View file

@ -4492,3 +4492,13 @@ int SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
}
return 0;
}
int SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
{
CHECK_RENDERER_MAGIC(renderer, -1);
if (vsync == NULL) {
return SDL_InvalidParamError("vsync");
}
*vsync = renderer->wanted_vsync;
return 0;
}