Add SDL_RenderDebugTextF & SDL_RenderDebugTextV

This should make it easier to quickly put important numbers and such on
the screen without having to format them into a string manually.
This commit is contained in:
williamistGitHub 2024-12-07 00:14:55 -05:00 committed by Ryan C. Gordon
parent 5608bf5866
commit 1d0e28a5b3
8 changed files with 126 additions and 2 deletions

View file

@ -2530,10 +2530,68 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int
*
* \since This function is available since SDL 3.1.6.
*
* \sa SDL_RenderDebugTextF
* \sa SDL_RenderDebugTextV
* \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
*/
extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);
/**
* Draw debug text to an SDL_Renderer.
*
* This function will render a printf() style format string to a renderer. Note
* that this is a convinence function for debugging, with severe limitations,
* and is not intended to be used for production apps and games.
*
* For the full list of limitations and other useful information,
* see SDL_RenderDebugText.
*
* \param renderer the renderer which should draw the text.
* \param x the x coordinate where the top-left corner of the text will draw.
* \param y the y coordinate where the top-left corner of the text will draw.
* \param fmt the format string to draw.
* \param ... format arguments
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.7.
*
* \sa SDL_RenderDebugText
* \sa SDL_RenderDebugTextV
* \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
*/
extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugTextF(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(4);
/**
* Draw debug text to an SDL_Renderer.
*
* This function will render a printf() style format string to a renderer. Note
* that this is a convinence function for debugging, with severe limitations,
* and is not intended to be used for production apps and games.
*
* For the full list of limitations and other useful information,
* see SDL_RenderDebugText.
*
* \param renderer the renderer which should draw the text.
* \param x the x coordinate where the top-left corner of the text will draw.
* \param y the y coordinate where the top-left corner of the text will draw.
* \param fmt the format string to draw.
* \param ap a variable argument lists representing the format arguments
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.1.7.
*
* \sa SDL_RenderDebugText
* \sa SDL_RenderDebugTextF
* \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
*/
extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugTextV(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(4);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}