you have to either use a string buffer then throw in it the numbers with the << operator or use something like itoa to convert them to text. Right now the value you give it is not something a string recognizes...
You only need to call addStaticText() once. After that you need to use setText(). Otherwise you're creating a new static text over the top of the old one every frame.
IGUIFont* font = device->getGUIEnvironment()->getFont("images/courier.bmp");
int lastFPS = 0;
while (device->run())
{
if (driver->beginScene(true, true, SColor(0,192,192,192)))
{
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
// only update fps display if fps changed
int fps = driver->getFPS();
if (font && (lastFPS != fps))
{
core::stringw str = L"FPS: ";
str += fps;
font->draw(str.c_str(), rect<s32>(10,10,300,60), video::SColor(255,255,255,255));
lastFPS = fps;
}
}
I don't know why you'd want to do that though. The IGUIStaticText does exactly the same thing, the only diference is that it creates a GUI element to hold the state.