//----------------------------------------------------------------------------// void OgreRenderer::constructor_impl(Ogre::RenderTarget& target) { d_pimpl->d_renderSystem = d_pimpl->d_ogreRoot->getRenderSystem(); d_pimpl->d_displaySize.d_width = target.getWidth(); d_pimpl->d_displaySize.d_height = target.getHeight(); // create default target & rendering root (surface) that uses it d_pimpl->d_defaultTarget = new OgreWindowTarget(*this, *d_pimpl->d_renderSystem, target); // hook into the rendering process d_pimpl->d_ogreRoot->addFrameListener(&S_frameListener); }
//----------------------------------------------------------------------------// void OgreRenderer::constructor_impl(Ogre::RenderTarget& target) { d_pimpl->d_renderSystem = d_pimpl->d_ogreRoot->getRenderSystem(); d_pimpl->d_displaySize.d_width = target.getWidth(); d_pimpl->d_displaySize.d_height = target.getHeight(); // create default target & rendering root (surface) that uses it d_pimpl->d_defaultTarget = CEGUI_NEW_AO OgreWindowTarget(*this, *d_pimpl->d_renderSystem, target); #if defined RTSHADER_SYSTEM_BUILD_CORE_SHADERS && OGRE_VERSION >= 0x10800 // default to using shaders when that is the sane thing to do. if (!d_pimpl->d_renderSystem->getFixedPipelineEnabled()) setUsingShaders(true); #endif // hook into the rendering process d_pimpl->d_ogreRoot->addFrameListener(&S_frameListener); }
CGUIManager::CGUIManager(Ogre::SceneManager *pSceneManager, Ogre::RenderTarget &target) : CEntity("GUIManager", nullptr), m_pSceneManager(pSceneManager), m_nRenderQueue(Ogre::RENDER_QUEUE_OVERLAY), m_bPostQueue(false), m_bRenderPause(false), m_vNativeRes(target.getWidth(), target.getHeight()), m_MouseMoving(MD_COUNT, false), m_fMouseSpeedX(0), m_fMouseSpeedY(0), m_fMouseAcceleration(2), m_fMouseInitialSpeed(50) { CInputListenerManager::getSingleton().addInputListener(this); OgreBites::SdkTrayManager *pTrayMgr = CGame::getSingleton().showLoadingBar(1, 1); pTrayMgr->loadBarSetCaption("GUI ..."); Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing CEGUI ***"); Ogre::LogManager::getSingletonPtr()->logMessage(" creating bootstrapSystem"); pTrayMgr->userUpdateLoadBar("Creating bootstrap system", 0.1); m_pCEGuiOgreRenderer = &CEGUI::OgreRenderer::bootstrapSystem(target); m_pCEGuiOgreRenderer->setFrameControlExecutionEnabled(false); Ogre::LogManager::getSingletonPtr()->logMessage(" setting up resource paths"); pTrayMgr->userUpdateLoadBar("Setting up resource paths", 0.1); CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets"); CEGUI::Font::setDefaultResourceGroup("Fonts"); CEGUI::Scheme::setDefaultResourceGroup("Schemes"); CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel"); CEGUI::WindowManager::setDefaultResourceGroup("Layouts"); Ogre::LogManager::getSingletonPtr()->logMessage(" creating scheme"); pTrayMgr->userUpdateLoadBar("Creating scheme", 0.1); createResources(); pSceneManager->addRenderQueueListener(this); Ogre::LogManager::getSingletonPtr()->logMessage(" creating root window"); pTrayMgr->userUpdateLoadBar("Initializing the root window", 0.1); CEGUI::Window *guiRoot = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MasterRoot"); m_pRoot = guiRoot; //guiRoot->setAlpha(0); guiRoot->setSize(USize(UDim(1, 0), UDim(1, 0))); //guiRoot->setProperty("BackgroundEnabled", "false"); CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(guiRoot); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("OgreTrayImages/MouseArrow"); //CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("OgreTrayImages/MouseInvisible"); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setPosition(CEGUI::Vector2f(0,0)); CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setConstraintArea(NULL); pTrayMgr->userUpdateLoadBar("Creating fonts", 0.2); createFreeTypeFont("dejavusans12", 12, "DejaVuSans.ttf"); createFreeTypeFont("dejavusans8", 8, "DejaVuSans.ttf"); createFreeTypeFont("dejavusans20", 20, "DejaVuSans.ttf"); CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont( "dejavusans12" ); guiRoot->setFont("dejavusans12"); pTrayMgr->userUpdateLoadBar("Creating gui components", 0.2); new CGUIDebugPullMenu(this, guiRoot, CGUIPullMenu::PMD_RIGHT); pTrayMgr->userUpdateLoadBar("done...", 0.2); Sizef vSize = CGUIManager::getSingleton().getNativeRes(); Ogre::LogManager::getSingleton().logMessage("GUIManager initialized..."); CGame::getSingleton().hideLoadingBar(); }