Displaying Integers!

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
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

Displaying Integers!

Post by Nosvera2 »

I just started using Irrlicht and have gone through the tutorials. I've begun putting together a simple 2D game and was wondering how to output integer variables to the screen. The tutorial includes the use of the "font and draw()" features but this only outputs const char. Is there anyway I can output integers to the screen? I would like to have certain variables displayed in the GUI at all times and I need this code to do it.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You cannot link variables to displays, but you have to convert the number to a string and display that one. Code for this can be found on the forum, but is also very simple to create on your own. Check the stringw class.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Code: Select all

int i = 10;
core::string<wchar_t> str(i);

core::rect<s32> rect(100,100,200,150);

guienvironment->addStaticText(str.c_str(), rect);
Post Reply