table of contents
SDL_RenderDebugText(3) | SDL3 FUNCTIONS | SDL_RenderDebugText(3) |
NAME¶
SDL_RenderDebugText - Draw debug text to an SDL_Renderer .
HEADER FILE¶
Defined in SDL3/SDL_render.h
SYNOPSIS¶
#include "SDL3/SDL.h"
bool SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);
DESCRIPTION¶
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:
• It accepts UTF-8 strings, but will only renders ASCII characters.
• It has a single, tiny size (8x8 pixels). One can use
logical presentation
or scaling to adjust it, but it will be blurry.
• It uses a simple, hardcoded bitmap font. It does not
allow different font
selections and it does not support truetype, for proper scaling.
• It does no word-wrapping and does not treat newline
characters as a line
break. If the text goes out of the window, it's gone.
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 ().
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns true on success or false on failure; call
SDL_GetError () for more information.
THREAD SAFETY¶
You may only call this function from the main thread.
AVAILABILITY¶
This function is available since SDL 3.2.0.
SEE ALSO¶
SDL 3.1.6 | Simple Directmedia Layer |