textout_centre_ex(3)

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

✨ textout_centre_ex ✨

okay bestie so this one lives in the Allegro manual and it's literally called textout_centre_ex β€” she's the one who writes a string centered on a bitmap πŸŽ€ part of the Allegro game programming library, no big deal πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

void textout_centre_ex(BITMAP *bmp, const FONT *f, const char *s, int x,
y, int color, int bg);

πŸ’– DESCRIPTION πŸ’–

So like… she's exactly like textout_ex(), bestie, no cap β€” same energy β€” except the x coordinate is interpreted as the centre instead of the left edge of the string. The way that changes EVERYTHING for you when you want your text actually centered πŸ˜­πŸ’–

Example time, look at her:

/* Important texts go in the middle. */
width = text_length("GAME OVER");
textout_centre_ex(screen, font, "GAME OVER",
                  SCREEN_W / 2, SCREEN_H / 2,
                  makecol(255, 0, 0), makecol(0, 0, 0));
not the width = text_length("GAME OVER"); line doing its little thing and then width not even getting used in the call πŸ‘€ iconic behavior fr fr, we don't question it, we just vibe πŸ¦‹

πŸ‘‘ SEE ALSO πŸ‘‘


Allegro, version 4.4.3, and this whole page is textout_centre_ex(3) β€” mwah, love u, go center something pretty πŸ’œβœ¨πŸ«Ά

πŸ“¦ where this page comes from