textout_centre_ex(3alleg4)
β¨ textout_centre_ex β Allegro manual, bestie edition β¨
okay so this is textout_centre_ex(3alleg4), straight out of the Allegro game programming library π she writes a centered string on a bitmap and honestly? she's the moment.
πΈ NAME πΈ
textout_centre_ex β writes a centered string on a bitmap. Allegro game programming library. no cap, that's literally her whole job π
π SYNOPSIS π
#include <allegro.h>
void textout_centre_ex(BITMAP *bmp, const FONT *f, const char *s, int x,
y, int color, int bg);
like look at her. so simple. so iconic. π¦
π DESCRIPTION π
So it's giving textout_ex()... but make it centered. β¨ That's it, that's the vibe.
The one thing you gotta internalize: the x coordinate here is the centre of your string, not the left edge. Not the beginning. The middle. The main character position. π
fr fr, if you pass the left edge you're gonna be off by half a string and you WILL notice π
Example, because a girl loves a demo:
/* 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));
SCREEN_W / 2 and SCREEN_H / 2? that's the center of the screen bestie. putting "GAME OVER" dead center in red on black. absolutely ate. π
π SEE ALSO π
textout_ex(3alleg4)β the non-centered sibling, still slayingtextprintf_centre_ex(3alleg4)β same energy but she does formatted output β¨
okay that's the whole page, go center some text and be great π«Ά
signing off with love from the Allegro girlies β this one's from version 4.4.3 of the Allegro manual. bye bestie, mwah πβ¨π§
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms