I want to draw my score to my display, but al_draw_text() only allows the drawing of constant pointer-to-char so it's impossible to draw something like an unsigned int score, even with itoa().
Is there a way to still do this? It's probably something real simple that I'm just overlooking xD
TIA
A couple minutes of poking around in the examples found this in ex_membmp.c.
I never really learned C but went straight to C++, so I am a bit confused with the C parts of this code.
I see that print() writes a shadowed text to the screen, but it still really used al_draw_text() to do it and so it still requires a *char.
I am guessing sprintf() is used to print fps into second line and so converts it into a string? If so I'll read up on sprintf() to see how it works so I can use this myself.
Thanks for the help bro
How about al_draw_textf? It'll take out the middle man, allowing you to pass the format string directly to the Allegro function. Look up a printf tutorial on the Internets to figure out how to use format strings (will help with sprintf too, if you end up needing it someday).
Also... you can use std::stringstream alongside al_draw_text for a more... C++... solution.
al_draw_textf() works perfectly!
I looked up some stuff about printf() and just using "%d" as the format works!
Thanks a lot everyone