TTF_DrawSurfaceText(3)
β¨ TTF_DrawSurfaceText β¨
okay bestie, gather round, it's TTF_DrawSurfaceText(3) time β a lil function from the SDL_ttf3 FUNCTIONS squad, and it's literally just "draw text to an SDL surface." that's the whole vibe. π
πΈ NAME πΈ
TTF_DrawSurfaceText β Draw text to an SDL surface. periodt.
π HEADER FILE π
Defined in SDL3_ttf/SDL_ttf.h
π¦ SYNOPSIS π¦
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface);
π DESCRIPTION π
so like. here's the tea. π« your text has to have been created using a TTF_TextEngine from
TTF_CreateSurfaceTextEngine().
no other engine, bestie. it's giving loyalty. iykyk.
β FUNCTION PARAMETERS β
textβ the text to draw. the main character, obviously. πxβ the x coordinate in pixels, positive from the left edge towards the right. β‘οΈyβ the y coordinate in pixels, positive from the top edge towards the bottom. β¬οΈsurfaceβ the surface to draw on. the canvas. the stage. the moment. β¨
π RETURN VALUE π
Returns true on success or false on failure β and if it's a flop, call SDL_GetError() for more information. π no cap, always check your errors.
π₯ THREAD SAFETY π₯
This function should be called on the thread that created the text. like, the SAME thread. don't be messy about it. π
π AVAILABILITY π
This function is available since SDL_ttf 3.0.0. so it's been iconic for a while now. π
π§ SEE ALSO π§
- β’(3)
TTF_CreateSurfaceTextEngine(3)- β’(3)
TTF_CreateText(3)
and that's the whole page, bestie!! go draw some text, slay, and remember to check that return value. π«Ά
β with love, from the SDL_ttf girlies. this one's part of SDL_ttf 3.2.2 ππΈπ
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms