/** * Initializes all resource (file) locations. * * We define the used set of CEGUI widgets with a scheme, * a XML file declaring the look of every named component. * The scheme file refers to other resource files, which CEGUI * will try to find from their appropriate directories. */ void setupCEGUIResources() { using namespace CEGUI; DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*> (System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "../../Media/gui/"); rp->setResourceGroupDirectory("imagesets", "../../Media/gui/"); rp->setResourceGroupDirectory("fonts", "../../Media/fonts/"); rp->setResourceGroupDirectory("layouts", "../../Media/gui/"); rp->setResourceGroupDirectory("looknfeels", "../../Media/gui/"); // This is only needed if you are using Xerces and need to // specify the schemas location rp->setResourceGroupDirectory("schemas", "../../Media/gui/"); // set the default resource groups to be used Imageset::setDefaultResourceGroup("imagesets"); Font::setDefaultResourceGroup("fonts"); Scheme::setDefaultResourceGroup("schemes"); WidgetLookManager::setDefaultResourceGroup("looknfeels"); WindowManager::setDefaultResourceGroup("layouts"); SchemeManager *schemeManager = SchemeManager::getSingletonPtr(); Scheme *scheme = schemeManager->loadScheme("TaharezLookSkin.scheme", "schemes"); assert( scheme ); // Again, you only need to this one if you are using xerces and have // defined a group for schemas. //CEGUI::XercesParser::setSchemaDefaultResourceGroup("schemas"); }
void Gui::init_throw() { SDL_ShowCursor(SDL_DISABLE); SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // FIXME: screen width & height in one place const SDL_VideoInfo* vidinfo = SDL_GetVideoInfo(); int width = vidinfo->current_w; int height= vidinfo->current_h; renderer = new CEGUI::OpenGLRenderer(0,width,height); new System( renderer , 0 , 0 , 0 , "" , BIN("CEGUI.log") ); DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*>( CEGUI::System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes",DATA("/gui/schemes/")); rp->setResourceGroupDirectory("imagesets", DATA("/gui/imagesets/")); rp->setResourceGroupDirectory("fonts", DATA("/gui/fonts/")); rp->setResourceGroupDirectory("layouts", DATA("/gui/layouts/")); rp->setResourceGroupDirectory("looknfeels", DATA("/gui/looknfeel/")); CEGUI::Imageset::setDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels"); CEGUI::WindowManager::setDefaultResourceGroup("layouts"); CEGUI::SchemeManager::getSingleton().loadScheme( "QuadraticLook.scheme" ); CEGUI::FontManager::getSingleton().createFont( "astroboy.font" ); System::getSingleton().setDefaultFont( "Astro Boy" ); System::getSingleton().setDefaultMouseCursor( "QuadraticLook", "MouseArrow" ); System::getSingleton().setDefaultTooltip( "QuadraticLook/Tooltip" ); }
void GUI::init() { try { // initialize CEGUI #ifdef __CEGUI_0_6_2__ new System(new OpenGLRenderer(0), NULL, NULL, NULL, "", "../log/zot.CEGUI.log"); #else OpenGLRenderer &renderer = OpenGLRenderer::create(); System::create(renderer, NULL, NULL, NULL, NULL, "", "../log/zot.CEGUI.log"); #endif // set default directories for GUI elements DefaultResourceProvider *rp = static_cast<DefaultResourceProvider *>(System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("imagesets", "../res/imagesets/"); rp->setResourceGroupDirectory("schemes", "../res/schemes/"); rp->setResourceGroupDirectory("fonts", "../res/fonts/"); rp->setResourceGroupDirectory("looknfeel", "../res/looknfeel/"); rp->setResourceGroupDirectory("layouts", "../res/layouts/"); // now link them to CEGUI Imageset::setDefaultResourceGroup("imagesets"); Scheme::setDefaultResourceGroup("schemes"); Font::setDefaultResourceGroup("fonts"); WidgetLookManager::setDefaultResourceGroup("looknfeel"); WindowManager::setDefaultResourceGroup("layouts"); // load the scheme file #ifdef __CEGUI_0_6_2__ SchemeManager::getSingleton().loadScheme("TaharezLook.scheme"); #else SchemeManager::getSingleton().create("TaharezLook.scheme"); renderer.enableExtraStateSettings(true); #endif // set a mouse cursor SYS.setDefaultMouseCursor("TaharezLook", "MouseArrow"); // create a blank root window and set as the main GUI sheet // all other windows will be children m_rootWin = WM.createWindow("DefaultWindow", "Root"); SYS.setGUISheet(m_rootWin); } catch (const CEGUI::InvalidRequestException &e) { cerr << e.getMessage() << endl; } catch (const CEGUI::UnknownObjectException &e) { cerr << e.getMessage() << endl; } catch (const CEGUI::GenericException &e) { cerr << e.getMessage() << endl; } }
//----------------------------------------------------------------------------// void Config_xmlHandler::initialiseResourceGroupDirectories() const { // if we are called, we dangerously assume that the resource provider is an // instace of DefaultResourceProvider... DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*> (System::getSingleton().getResourceProvider()); ResourceDirVector::const_iterator i = d_resourceDirectories.begin(); for (; i != d_resourceDirectories.end(); ++i) rp->setResourceGroupDirectory((*i).group, (*i).directory); }
void D3DCEGUI::init(ID3D11Device *pD3D11Device, ID3D11DeviceContext *pD3D11DeviceContext) { // create renderer and enable extra states Direct3D11Renderer& cegui_renderer = Direct3D11Renderer::create(pD3D11Device, pD3D11DeviceContext); // cegui_renderer.enableExtraStateSettings(true); // create CEGUI system object CEGUI::System::create(cegui_renderer); // setup resource directories DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*>(System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "../../media/datafiles/schemes/"); rp->setResourceGroupDirectory("imagesets", "../../media/datafiles/imagesets/"); rp->setResourceGroupDirectory("fonts", "../../media/datafiles/fonts/"); rp->setResourceGroupDirectory("layouts", "../../media/datafiles/layouts/"); rp->setResourceGroupDirectory("looknfeels", "../../media/datafiles/looknfeel/"); rp->setResourceGroupDirectory("lua_scripts", "../../media/datafiles/lua_scripts/"); rp->setResourceGroupDirectory("schemas", "../../media/datafiles/xml_schemas/"); // set default resource groups ImageManager::setImagesetDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); Scheme::setDefaultResourceGroup("schemes"); WidgetLookManager::setDefaultResourceGroup("looknfeels"); WindowManager::setDefaultResourceGroup("layouts"); ScriptModule::setDefaultResourceGroup("lua_scripts"); XMLParser* parser = System::getSingleton().getXMLParser(); if (parser->isPropertyPresent("SchemaDefaultResourceGroup")) parser->setProperty("SchemaDefaultResourceGroup", "schemas"); // load TaharezLook scheme and DejaVuSans-10 font SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "schemes"); FontManager::getSingleton().createFromFile("DejaVuSans-10.font"); // set default font and cursor image and tooltip type System::getSingleton().getDefaultGUIContext().setDefaultFont("DejaVuSans-10"); System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow"); System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("TaharezLook/Tooltip"); ///////////////////////////////////////////////////////////// // Add your gui initialisation code in here. // You should preferably use layout loading because you won't // have to recompile everytime you change the layout. But you // can also use static window creation code here, of course. ///////////////////////////////////////////////////////////// //System::getSingleton().notifyDisplaySizeChanged(Sizef(800.f, 600.f)); // load layout Window* root = WindowManager::getSingleton().loadLayoutFromFile("application_templates.layout"); System::getSingleton().getDefaultGUIContext().setRootWindow(root); // notify system of the window size renderer= static_cast<Direct3D11Renderer*>(System::getSingleton().getRenderer()); }