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();
}