Draw debug text to an SDL_Renderer.
Defined in <SDL3/SDL_render.h>
bool SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);
SDL_Renderer * | renderer | the renderer which should draw a line of text. |
float | x | the x coordinate where the top-left corner of the text will draw. |
float | y | the y coordinate where the top-left corner of the text will draw. |
const char * | str | the string to render. |
(bool) Returns true on success or false on failure; call SDL_GetError() for more information.
This function will render a string of text to an SDL_Renderer. Note that this is a convenience function for debugging, with severe limitations, and not intended to be used for production apps and games.
Among these limitations:
For serious text rendering, there are several good options, such as SDL_ttf, stb_truetype, or other external libraries.
On first use, this will create an internal texture for rendering glyphs. This texture will live until the renderer is destroyed.
The text is drawn in the color specified by SDL_SetRenderDrawColor().
You may only call this function from the main thread.
This function is available since SDL 3.1.3.