I want to put text over a graphic, like a button or whatever, and have it centered. Right now I'm just doing it manually by adding onto the x position of the text until it looks good, which is a pain in the ass.
Omigod omigod omigod! Are you single?
A thank you would suffice
Please bookmark this: http://www.allegro.cc/manual/
Please. 
(oh, and the alternative method would be to use text_length(font,"the text"), and subtract half that from the x value)
Top right corner. The previous question was much more then a thank you
but thank you. I seen this function before but never really thought anything of it at the time because I didn't need it, then I forgot about it.
Edit:
That works.. But if I move the image the text was over then the text will remain in the same spot (because I'm no longer giving it the image's current x and y position.)
Nm I think.
textout_centre_ex(buffer, font, caption.c_str(), xPos + width / 2, yPos, WHITE, -1);
If you create a button, you know the button's coordinates. When you use textout_centre_ex, simply use the button's xPos,yPos coordinates, and the centered text should correctly align no matter where the button is located on the screen.
textout_centre_ex(buffer, font, caption.c_str(), button_xPos + width / 2, button_yPos, WHITE, -1);