Hi all
I have made a simple static text box which says how many points you have in my game. I need to make it like this:
"Kills = " int1 + "/" and int2
int 1 is the kills, int2 is the required kills
How can I add integers like that too strings? I saw it done in the demo, I am just not sure how. I am sure this is really simple, but I am really tired right now (midnight here) and had a busy day so help will be appreciated.
Include integer in static text (noobie, I know)
or:
Code: Select all
stringw strText = "Kills : ";
strText += int1;
strText += "/";
strText += int2;
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Uhm... why the first solution doesn't work for me?
Using the B@z approach (which I've seen employed also on tutorial 14) I get the following error when I call the swsprintf() function.
/Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D/gui.cpp:229: error: cannot convert 'const char*' to 'const wchar_t*' for argument '3' to 'int swprintf(wchar_t*, size_t, const wchar_t*, ...)'
I was looking here since I'm trying to convert some integer values into wchar_t in order to pass them to an IGUIEditBox...
Any hints?
Using the B@z approach (which I've seen employed also on tutorial 14) I get the following error when I call the swsprintf() function.
/Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D/gui.cpp:229: error: cannot convert 'const char*' to 'const wchar_t*' for argument '3' to 'int swprintf(wchar_t*, size_t, const wchar_t*, ...)'
I was looking here since I'm trying to convert some integer values into wchar_t in order to pass them to an IGUIEditBox...
Any hints?
Yes, in this way it works perfectly...Eigen wrote:You're missing a L (meaning a wide character) in front of your " "
swprintf(temp, 256, L"Kills = %i / %i", kills, requiredkills);
Code: Select all
IGUIEditBox *editBox;
wchar_t temp[256];
int a = 10;
editBox = gui_env->addEditBox(L"0", rect<s32>(915,28,1015,48));
swprintf(temp, 256, L"%i", a);
editBox->setText(temp);