im trying to output the players health and mana for my game but according to the error in deccpp
invalid conversion from 'int' to const char*
textout_ex( buffer, font, text, x, y, color, color);
does not work with integers. so how do i print integers to the screen?
#include <sstream> using namespace std; ... stringstream ss; ss << 49; textout_ex(buffer, font, ss.str().c_str(), x, y, color, color);
Or (because I know someone else is going to post this
):
textprintf_ex(buffer, font, x, y, color, color, "%d", 49);
On a side note: Using the same color for fg and bg is probably not what you want. I'd recommend -1 for your bg parameter.
I dont really understand the second function you did. I get the first 6 parameters but what are the last two? The int and ....?
Read about the printf function:
printf
Just stick with the first solution, its better anyway.
You should probably read (or re-read) some tutorials on C/C++ basics as well.
Just stick with the first solution, its better anyway.
I'd go with the second method for consistency.
I dont really understand the second function you did. I get the first 6 parameters but what are the last two? The int and ....?
text_printf is Allegro's version of the standard printf function with extra parameters (destination bitmap, colour, position).
Ok I read it. thx;D