add static text problem

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
JuicyLobster
Posts: 25
Joined: Sat Jun 07, 2008 8:55 pm

add static text problem

Post by JuicyLobster »

Code: Select all

		guiE = device->getGUIEnvironment();
		guiE->getSkin()->setFont(guiE->getFont("ffont.bmp"));
		guiE->addStaticText(L"This is a test",core::rect<s32>(10,10,260,22), false);
Text will not show, and yes, its draw function is drawing, because it works when i comment out the guiE->getSkin()->setFont() line
--
Juicy, hot, and full of butter!
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Re: add static text problem

Post by Rytz »

JuicyLobster wrote:

Code: Select all

		guiE = device->getGUIEnvironment();
		guiE->getSkin()->setFont(guiE->getFont("ffont.bmp"));
		guiE->addStaticText(L"This is a test",core::rect<s32>(10,10,260,22), false);
Text will not show, and yes, its draw function is drawing, because it works when i comment out the guiE->getSkin()->setFont() line
If it works with the default Irrlicht font but not with yours, are you sure your font is formatted correctly?
Image
JuicyLobster
Posts: 25
Joined: Sat Jun 07, 2008 8:55 pm

Post by JuicyLobster »

i used the font tool that was in the engines bin folder
--
Juicy, hot, and full of butter!
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

JuicyLobster wrote:i used the font tool that was in the engines bin folder
What do you get back if you use getKerningWidth on the font?
Image
JuicyLobster
Posts: 25
Joined: Sat Jun 07, 2008 8:55 pm

Post by JuicyLobster »

console says the amount of upper corner pixels or lower corner pixels is == 0, font file may be corrupted...
--
Juicy, hot, and full of butter!
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

JuicyLobster wrote:console says the amount of upper corner pixels or lower corner pixels is == 0, font file may be corrupted...
Might wanna check up on the font creater... people might have posted some bugs with it. Sorry I don't have better news for you :|.
Image
JuicyLobster
Posts: 25
Joined: Sat Jun 07, 2008 8:55 pm

Post by JuicyLobster »

hmmm, anyone have a history of font tool in the bin folder of irrlicht not working?
--
Juicy, hot, and full of butter!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

When using the new font tool you have to load the .xml file, just as the docs tell you
Maybe another candiadte for the FAQs - ah, should be already in but people simply skip over it...
JuicyLobster
Posts: 25
Joined: Sat Jun 07, 2008 8:55 pm

Post by JuicyLobster »

hybrid wrote:When using the new font tool you have to load the .xml file, just as the docs tell you
Maybe another candiadte for the FAQs - ah, should be already in but people simply skip over it...
Ok, got it to work now, but how about font colour/style? Shouldn't it be using the patterns of the image file? All it does it make everything black...

What I am trying to accomplish is a outlined (1pixel) black outline around the font done in photoshop with stroke after using the fonttool. But irrlicht seems to want to make any colour on the image black. Is there a way to do this?
--
Juicy, hot, and full of butter!
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

You can change color of text with IGUISkin::setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) or IGUIFont::draw (const wchar_t *text, const core::rect< s32 > &position, video::SColor color, bool hcenter=false, bool vcenter=false, const core::rect< s32 > *clip=0)

For effect you described you need to use texture ...or create your own font class.
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: add static text problem

Post by feelthat »

void COpenGLDriver::setRenderStates2DMode

if (!OverrideMaterial2DEnabled)
{
//here add it
InitMaterial2D.Lighting=false; //by stone, fix gui bug
setBasicRenderStates(InitMaterial2D, LastMaterial, true, true);
LastMaterial = InitMaterial2D;
}
JuicyLobster wrote:

Code: Select all

        guiE = device->getGUIEnvironment();
        guiE->getSkin()->setFont(guiE->getFont("ffont.bmp"));
        guiE->addStaticText(L"This is a test",core::rect<s32>(10,10,260,22), false);
Text will not show, and yes, its draw function is drawing, because it works when i comment out the guiE->getSkin()->setFont() line
Post Reply