font->draw, Question.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Necrozard
Posts: 14
Joined: Sat Jul 05, 2008 8:49 pm

font->draw, Question.

Post by Necrozard »

Hi everyone. I have a question with this function.

I have this variable: int Damage=(rand()%201 +200);

Then i want to a text on the screen representing that Damage. I try: (L"%S"+Damage); and (L"%S"+(int)Damage); too, but nothing.

I want to set the Damage value on screen. This is my current line:

font->draw(L"Damage: "+Damage,rect<s32>(enemy_damagedraw_coords.X-10,enemy_damagedraw_coords.Y-70+(DRAW_DAMAGE_AUX-255)/6,300,50),color);

enemy_damagedraw_coords, its a position2d<s32>, variable, but it doesnt matter here.

That line, the font-draw one, give me on screen letters, separated.

I only want to set the Damage value on Screen, with font->draw, but i dont know how.

Help me please, good bye!
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

L"something" makes a pointer, IIRC, so you're just creating a bad pointer by doing L"something" + int. Try this:

Code: Select all

core::stringw str = L"Damage: ";
str += Damage;
font->draw(str.c_str(), ...
Post Reply