How to print a variable as text?

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
Jorik
Posts: 44
Joined: Tue Dec 08, 2009 4:47 pm

How to print a variable as text?

Post by Jorik »

Hi,

i´m saving a value in a variable :

Code: Select all

s32 ponts = 15
.

This value is increasing constantly.

I want to draw always the actual value on the screen (not in the console).

I use this to draw text:

Code: Select all

gui::IGUIFont* font = Device->getGUIEnvironment()->getBuiltInFont();
	
if(font)
	{
		
		font->draw(L"want to draw a value but dont know how",core::rect<s32>(130,10,300,200),
                                     video::SColor(255,255,255,255));
.


I have two questions now:

How can i display the variable value?
How can i choose another size for the font?


Thanks for every help
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: How to print a variable as text?

Post by randomMesh »

Jorik wrote: How can i display the variable value?
You can use something like

Code: Select all

font->draw(irr::core::stringw(yourVariable).c_str(), ...);
Jorik wrote: How can i choose another size for the font?
You need to use the font tool and make one.
"Whoops..."
Jorik
Posts: 44
Joined: Tue Dec 08, 2009 4:47 pm

Post by Jorik »

Thank you :D
Post Reply