本文整理汇总了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");
}
}