SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_RenderDebugText

Draw debug text to an SDL_Renderer.

Header File

Defined in <SDL3/SDL_render.h>

Syntax

bool SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);

Function Parameters

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.

Return Value

(bool) Returns true on success or false on failure; call SDL_GetError() for more information.

Remarks

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().

Thread Safety

This function should only be called on the main thread.

Version

This function is available since SDL 3.1.6.

See Also


CategoryAPI, CategoryAPIFunction, CategoryRender


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.