- Online Community Forums » Programming Questions » Drawing text from variable in Allegro5

Credits go to LennyLen for helping out!
This thread is locked; no one can reply to it. rss feed Print
Drawing text from variable in Allegro5
Member #14,175
April 2012

Hello !!

I would like to draw text from a variable with a simple function in allegro 5 but i can't find anything in the manual.

Could you tell me if there is a substitute or an easy way to emulate the following function from allegro 4.4.2 ?

void textprintf_ex(BITMAP *bmp, const FONT *f, int x, int y, int color, int bg, const char *fmt, ...);
int player_score;
textprintf_ex(screen, font, 10, 10, makecol(255, 100, 200),-1, "Score: %d", player_score);

Also i wonder why this function dit not make it into v5, was it because of it inefficiency ?

Member #5,313
December 2004

The equivalent A5 function is al_draw_textf

Member #14,175
April 2012

Thank you so much, perfect !

...I feel very dumb right now for missing this :-X

Go to: