textprintf_ex(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– textprintf_ex(3) β€” the Allegro manual, but make it cute πŸ’–

okay so bestie, welcome to the Allegro game programming library manual page for textprintf_ex(3). yes it's a C function. yes it's from Allegro. yes we're gonna make it slay. πŸŽ€


✨ NAME ✨

textprintf_ex β€” formatted output of a string, brought to you by the Allegro game programming library. it's giving printf but for your screen. πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

void textprintf_ex(BITMAP *bmp, const FONT *f, int x, int y, int color,
int bg, const char *fmt, ...);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this is formatted text output using a printf() style format string. you hand it a bitmap, a font, some coordinates, a color, a background, and a format string, and it just writes the whole thing for you. main character energy fr fr. ✨

⚠️ but listen β€” due to an internal limitation, this function can't be used for extremely long texts. not a vibe, but it is what it is.

if you happen to hit that limit (and you'll know), the workaround is to use uszprintf() and textout_ex() instead, because those two don't have any such limit. okay so here's the example they gave us, verbatim, no cap:

int player_score;
...
textprintf_ex(screen, font, 10, 10, makecol(255, 100, 200),
              -1, "Score: %d", player_score);

look at that. makecol(255, 100, 200)?? that's a pink-ish color and honestly? iconic. 🩷 the -1 background means transparent vibes. iykyk.


πŸ‘‘ SEE ALSO πŸ‘‘

go read these next bestie, they're all in the family:


that's the whole page, bestie. this manual page came from Allegro, version 4.4.3, and the page itself is textprintf_ex(3). go forth and format your strings. πŸ«ΆπŸ’œπŸŒ·

πŸ“¦ where this page comes from