I'm using Nalins CGUITTFont to get true type fonts into my program and am having a hard time figuring out how to get different font sizes to show up on the screen.
I create two different sized fonts like this:
Code: Select all
font16 = CGUITTFont::createTTFont(guienv, "C:\\Windows\\fonts\\calibri.ttf", 16);
font32 = CGUITTFont::createTTFont(guienv, "C:\\Windows\\fonts\\calibri.ttf", 32);
And apply one to the skin like this:
Code: Select all
skin = guienv->getSkin();
skin->setFont(font16);
skin->setColor(EGDC_BUTTON_TEXT, SColor(255, 255, 255, 255));
Now lets say I want to display some size 16 text, and then somewhere else on the screen display some size 32 text. I'm not really sure how to do it (it must be possible, surely?). I've tried:
Code: Select all
guienv->addStaticText(L"Some text", rect<s32>(10, 10, 50, 50), false);
skin->setFont(font32);
skin->setColor(EGDC_BUTTON_TEXT, SColor(255, 255, 255, 255));
guienv->addStaticText(L"Some more text", rect<s32>(100, 100, 150, 150), false);
But all that does it make all the text size 32. I also tried to use the draw() function in CGUITTFont (i.e. font32->draw(etc etc)) but that doesn't draw anything (but then I don't know how it's supposed to work). I've tried combinations of other things like calling multiple guienv->drawAll() at different stages. I'm really stumped.
So how does it work? Does it even work? I could just keep all the text the same size, but I'd prefer not to.