Drawing variables on the screen

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
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Drawing variables on the screen

Post by sudi »

Ok actually pretty simple but i dont get it.....
i want to write with the font function a variable on the screen....but it doesnt work at all cause the formats dont fit...how can i do this?

Code: Select all

comicfont->draw(player->m_health, rect<s32>(5,675,128,768),SColor(0,0,0,0));
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

smgr.addStaticTextNode() ?

That would work, you can look in the Shaders tutorial for more info, but may not be quite what ur after!
Image Image Image
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Ok...but how should that work?
i tried this already...

Code: Select all

hudmgr->addTextSceneNode(font2,leben,SColor(0,0,0,0),0);
and that doesnt work either.
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

I think if you change

"comicfont->draw(player->m_health, rect<s32>(5,675,128,768),SColor(0,0,0,0));"

to

"comicfont->draw(player->m_health.c_str(), rect<s32>(5,675,128,768),SColor(0,0,0,0));"

it should work.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Hmmm it doesn't work the compiler tells me that c_str isn't declared....
edit:
i changed a little bit now it works....it has to be

Code: Select all

comicfont->draw(stringw(player->m_health).c_str(), rect<s32>(5,675,128,768),SColor(0,0,0,0));
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

heh sorry I lost a parenthesis on you there :/
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

Look at him go only a 100 posts later and dances went from forum noob to Mr. Wizard.
Post Reply