Problem trying to use a custom font for the GUI
Posted: Wed Nov 01, 2017 7:36 pm
Hi! This is my first project using Irrlicht.
I created a device and I am trying to create a GUI, but I fail to set a custom font as the one in use.
This is my code:
Stdout doesn't print any error, and in fact everything works as expected. The only problem is that the font used by the GUI is still the default one, and not the one I loaded. I tryed also with a .bmp font with the same result. Thank you very much to anyone helps me out
I created a device and I am trying to create a GUI, but I fail to set a custom font as the one in use.
This is my code:
Code: Select all
irr::gui::IGUIFont *tatofont;
// guienv is the IGUIEnvironment pointer
guienv->addFont("../data/fonts/Dashley.ttf", tatofont);
if (tatofont)
// skin is the IGUISkin pointer
skin->setFont(tatofont);
skin->setFont(guienv->getBuiltInFont(), irr::gui::EGDF_TOOLTIP);
// background image
guienv->addImage(
// driver is the IVideoDriver pointer
driver->getTexture("../data/artwork/background.jpg"),
irr::core::position2d<int>(0,0) );
// title
guienv->addStaticText(
L"TATO ADVENTURES",
irr::core::rect<irr::s32>(10,10, window_x, window_y) );
// new game button
guienv->addButton(
irr::core::rect<irr::s32>(20, 50, window_x/3, 70), 0, BUTTON_NEW,
L"NEW GAME", L"Start the adventure!" );
// quit button
guienv->addButton(
irr::core::rect<irr::s32>(20, 90, window_x/3, 110), 0, BUTTON_QUIT,
L"QUIT", L"You really want to leave us?" );
// render it all
// device is the IrrlichtDevice pointer
while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, irr::video::SColor(0,200,200,200));
guienv->drawAll();
driver->endScene();
}