Hi CE
- Yes, I'm using 0.7.2
- The render system is Direct3D9
- Im using a MenuBar and a FrameThingie for the AboutDialog (actually based on the Static Text sample)
Here's the setup code:
Code: Select all
guiRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
CEGUI::Font::setDefaultResourceGroup("Fonts");
CEGUI::Scheme::setDefaultResourceGroup("Schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
CEGUI::SchemeManager::getSingleton().create("VanillaSkin.scheme");
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
uiRoot = wmgr.createWindow( "DefaultWindow", "uiRoot" );
CEGUI::System::getSingleton().setGUISheet(uiRoot);
CEGUI::Window *mainMenu = wmgr.loadWindowLayout("g0_mainmenu.layout");
uiRoot->addChildWindow(mainMenu);
and here I create the about dialog:
Code: Select all
bool generat0r::showAboutDialog(const CEGUI::EventArgs &e)
{
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
//need to check if layout is already loaded - can only be loaded once
CEGUI::Window *aboutDialog;
if(!wmgr.isWindowPresent("generat0r_AboutDialog") )
{
aboutDialog = wmgr.loadWindowLayout("g0_aboutdialog.layout");
//aboutDialog->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0 ), CEGUI::UDim( 0.25f, 0 ) ) ); // this is now done in the layout where it works!
CEGUI::Window* textComponent = (CEGUI::Window*)CEGUI::WindowManager::getSingleton().getWindow("generat0r/AboutDialog/StaticText");
textComponent->setText("This is just some text that shows how nicely [colour='FFFF0000']CEGUI can format strings.[colour='FF00FF00'] and this is just colour [colour='FF0000FF'] formatting!");
uiRoot->addChildWindow(aboutDialog);
CEGUI::PushButton* UI_CloseButton = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().getWindow("generat0r/AboutDialog/CloseButton");
UI_CloseButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&generat0r::hideAboutDialog, this));
}
else
{
//aboutDialog = static_cast<CEGUI::Window*>(wmgr.getWindow("generat0r_AboutDialog"));
aboutDialog = static_cast<CEGUI::Window*>(uiRoot->getChild("generat0r_AboutDialog"));
aboutDialog->show();
aboutDialog->activate();
}
return true;
}
If you need the layouts too - let me know.
Cheers,
michael