当前位置: 首页>>代码示例>>C++>>正文


C++ WindowManager::loadLayoutFromString方法代码示例

本文整理汇总了C++中cegui::WindowManager::loadLayoutFromString方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowManager::loadLayoutFromString方法的具体用法?C++ WindowManager::loadLayoutFromString怎么用?C++ WindowManager::loadLayoutFromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cegui::WindowManager的用法示例。


在下文中一共展示了WindowManager::loadLayoutFromString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateCEGUIWindow

void GameConsoleWindow::CreateCEGUIWindow()
{
	// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing
	CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();
 
    // Now before we load anything, lets increase our instance number to ensure no conflicts.  
    // I like the format #_ConsoleRoot so thats how i'm gonna make the prefix.  This simply
    // Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string. 
    sNamePrefix = ++iInstanceNumber + "_";
 
    // Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window
    // and assign it to our member window pointer m_ConsoleWindow
    // inLayoutName is the name of your layout file (for example "console.layout"), don't forget to rename inLayoutName by our layout file
	CasaEngine::IFile* pFile = CasaEngine::MediaManager::Instance().FindMedia("GameConsole.layout", CasaEngine::FileMode::READ);
	if (pFile != nullptr)
	{
		CEGUI::String xmlStr(pFile->GetBuffer());
		m_ConsoleWindow = pWindowManager->loadLayoutFromString(xmlStr);
		DELETE_AO pFile;
		pFile = nullptr;
	}
	else
	{
		throw CasaEngine::CLoadingFailed("GameConsole.layout", "");
	}
 
    // Being a good programmer, its a good idea to ensure that we got a valid window back. 
    if (m_ConsoleWindow)
    {
		CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(m_ConsoleWindow);

        // Lets add our new window to the Root GUI Window
        //CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChildWindow(m_ConsoleWindow);
		//CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_ConsoleWindow);
        // Now register the handlers for the events (Clicking, typing, etc)
        (this)->RegisterHandlers();
    }
    else
    {
        // Something bad happened and we didn't successfully create the window lets output the information
        CEGUI::Logger::getSingleton().logEvent("Error: Unable to load the ConsoleWindow from .layout");
    }
}
开发者ID:xcasadio,项目名称:casaengine,代码行数:43,代码来源:GameConsoleWindow.cpp


注:本文中的cegui::WindowManager::loadLayoutFromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。