Displaying text
Displaying text
I am trying to make a FPS and need to draw big font for the HUD. I need to know how do i display text for things like the bullets(which changes values whenever shot) and life. I need like a size 16 font. Please post some sample code
Code: Select all
IGUIEnvironment* guienv = gDevice->getGUIEnvironment();
// If you keep a pointer to bulletStat you can just change the text when you want.
IGUIStaticText *bulletStat = guienv->addStaticText(L"", rect<int>(5,-2,640,38), false);
// set custom font...The irrLicht download contains a font generation tool, in the Tools folder
IGUISkin *skin = guienv->getSkin();
gui::IGUIFont* font = gDevice->getGUIEnvironment()->getFont("font.bmp");
skin->setFont( font );
// you could call something like this whenever the bullet count changes
wchar_t tmp[320];
swprintf(tmp, 320, L"Bullets: %i", bulletCount);
bulletStat->setText(tmp);
"Build a man a fire and he'll be warm for the evening. Set a man on fire and he'll be warm for the rest of his life." -unknown
Code: Select all
// If you keep a pointer to bulletStat you can just change the text when you want.
IGUIStaticText *bulletStat = guienv->addStaticText(L"", rect<int>(5,-2,640,38), false);
Code: Select all
wchar_t tmp[320];
swprintf(tmp, 320, L"Bullets: %i", bulletCount);
bulletStat->setText(tmp);
.: http://www.mercior.com :.
Check the documentation for a function
greetings, rincewind
Code: Select all
IStaticText::setOverrideColor(SColor)