al_draw_text(3alleg5)
π NAME π
al_draw_text β the Allegro 5 API's own little text-slapping bestie β¨
(It lives in the Allegro 5 manual, section 3alleg5, and honestly? She's iconic.)
β¨ SYNOPSIS β¨
#include <allegro5/allegro_font.h>
void al_draw_text(const ALLEGRO_FONT *font,
ALLEGRO_COLOR color, float x, float y, int flags,
char const *text)
π DESCRIPTION π
Okay so basically, al_draw_text takes your text β which is a NUL-terminated string, no cap β and writes it onto the target bitmap at position x, y, using the font you picked. That's it. That's the whole vibe. π¦
The flags parameter can be 0, or one of these three:
ALLEGRO_ALIGN_LEFTβ draws the text left-aligned. Lowkey the same thing as0, bestie. They're literally twins. π―ALLEGRO_ALIGN_CENTREβ draws the text centered around the given position. Not starting at it, around it. Very main character energy. πALLEGRO_ALIGN_RIGHTβ draws the text right-aligned to the given position.
And you can also combine that with this one:
ALLEGRO_ALIGN_INTEGERβ always draws text aligned to an integer pixel position. This used to be the default behaviour btw, so if you're porting old code and things look slightly off, that's why π. Since: 5.0.8, 5.1.4.
π Real talk though: this function does NOT support newline characters (\n). Not even a little. If you want multi-line text output you gotta go useal_draw_multiline_text(3alleg5)instead, fr fr.
πΈ SEE ALSO πΈ
al_draw_ustr(3alleg5)al_draw_textf(3alleg5)al_draw_justified_text(3alleg5)al_draw_multiline_text(3alleg5)
And that's the whole page, bestie π«Ά β this one came straight out of the Allegro reference manual, filed under al_draw_text(3alleg5). Go forth and draw some text. Slay. π
β¨
π¦ where this page comes from
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms