textprintf_centre_ex(3)

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

πŸ’– textprintf_centre_ex β€” the Allegro manual, but make it cute ✨

okay bestie, we're in the Allegro game programming library manual, and today's main character is textprintf_centre_ex. she prints formatted text. she centres it. she slays. let's get into it πŸŽ€


✨ NAME ✨

textprintf_centre_ex β€” formatted centered output of a string, from the Allegro game programming library πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

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

πŸ’… DESCRIPTION πŸ’…

okay so. this one is literally textprintf_ex()'s cooler twin β€” same energy, but she treats the x coordinate as the centre of the string instead of the left edge. main character positioning only, no cap πŸ‘‘

lowkey important though: this function shares the text length limitation of textprintf_ex(). so like, know that going in, bestie. don't say I didn't warn you πŸ™ˆ

here's the vibe in action:

textprintf_centre_ex(screen, font, SCREEN_W / 2, 120,
                     makecol(0, 100, 243), -1,
                     "Your best score so far was %d!",
                     total_max_points);

the way that SCREEN_W / 2 just drops your text dead centre... obsessed. genuinely. πŸ”₯


🌈 SEE ALSO 🌈

iykyk, go read those next 🫢


Allegro, version 4.4.3 β€” mwah, that's the whole page babes, textprintf_centre_ex(3) out πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from