Hello guys.
Well I was figuring out how can I print multiple chars (array) in an al_draw_textf.
So I got this:
My char and a size var to hold the size of the array, now the for loop:
Everything seems fine but I get a disorder of my letters, and I get the following on my screen:
{"name":"0k9y.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/f\/af1e63049791db4f60d261d41cc3e935.png","w":650,"h":514,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/f\/af1e63049791db4f60d261d41cc3e935"}
So my question is: Is there a way to draw text to the screen from a char a better way?? Or how can I improve this one?
Thanks
Any specific reason you don't simple use:
al_draw_textf(font, al_map_rgb(255, 255, 255), 10, 20, 0, "%s", text[i]);
Or al_draw_text without format?
Is there any particular reason why you're not just using:
al_draw_textf(font, al_map_rgb(255,255,255), 10 + (i * 10), 20, 0, "%s", text);
If you do want to draw individual characters after each other, you need to use al_get_text_width to calculate the width of each character so you know where to draw the next one.
Ohh thank you, I forgot about the %s
Thank you guys
Everything seems fine but I get a disorder of my letters, and I get the following on my screen:
The actual disorder you're getting is that you're monospacing a font that's not supposed to be monospaced. So you would have to use a higher spacing than 10 pixels in that case so "wide" letters like 'e' won't cross into the other letters, while the "thin" letters will seem like there's too much space between them.