此处介绍 CEGUI 0.4.1
官方:http://sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2/0.4.1/
(2005-11-26)
10.1 Cegui 初始化
Cegui 的初始化在 CUISystem::Initial 中完成。
CEGUIBase.dll!CEGUI::XMLAttributes::getValueAsInteger
CEGUIBase.dll!CEGUI::Imageset_xmlHandler::elementStart
CEGUIBase.dll!CEGUI::ExpatParser::startElement
CEGUIBase.dll!_XML_GetFeatureList
CEGUIBase.dll!_XML_GetFeatureList
CEGUIBase.dll!_XML_GetFeatureList
CEGUIBase.dll!_XML_GetFeatureList
CEGUIBase.dll!_XML_GetFeatureList
CEGUIBase.dll!_XML_ParseBuffer
CEGUIBase.dll!_XML_Parse
CEGUIBase.dll!CEGUI::ExpatParser::parseXMLFile
CEGUIBase.dll!CEGUI::Imageset::load
CEGUIBase.dll!CEGUI::Imageset::Imageset
CEGUIBase.dll!CEGUI::ImagesetManager::createImageset
CEGUIBase.dll!CEGUI::Scheme::loadResources
CEGUIBase.dll!CEGUI::Scheme::Scheme
CEGUIBase.dll!CEGUI::SchemeManager::loadScheme
CEGUISystem.dll!CUISystem::Initial
WXClient.exe!CGameProcedure::InitStaticMemeber
WXClient.exe!_tMain_With_CPPException
WXClient.exe!WinMain
WXClient.exe!__tmainCRTStartup
WXClient.exe!WinMainCRTStartup
UI 脚本
在 cegui 创建时(CUISystem::Initial),将脚本接口对象传入创建过程即可:
m_pCEGUISystem = new CEGUI::System( m_pCEGUIRender, m_pCEGUIScript, (const
CEGUI::utf8*)"");
ScriptModule 即是脚本接口。
class CGameUIScript : public ScriptModule
10.2 模块的加载
分析一个模块从发现到死亡的历程
10.3 模块定义
struct UIModule
{
String name;
FactoryModule* module;
std::vector<UIElementFactory> factories;
};
struct UIElementFactory
{
String name;
};
10.4 发现新模块(WindowSet)
10.5 模块的诞生
在加载资源的时候,首先创建所有被发现的模块
CEGUI\src\CEGUIScheme.cpp
CEGUI.Scheme.loadResources
std::vector<UIModule>::iterator cmod = d_widgetModules.begin();
for (;cmod != d_widgetModules.end(); ++cmod)
{
// create and load dynamic module as required
if ((*cmod).module == NULL)
{
(*cmod).module = new FactoryModule((*cmod).name);
10.6 模块的灭亡
主动销毁模块
CEGUI\src\CEGUIScheme.cpp
CEGUI.Scheme.resourcesLoaded
// check factories
std::vector<UIModule>::const_iterator cmod = d_widgetModules.begin();
for (;cmod != d_widgetModules.end(); ++cmod)
{
std::vector<UIElementFactory>::const_iterator elem = (*cmod).factories.begin();
for (; elem != (*cmod).factories.end(); ++elem)
{
if (!wfmgr.isFactoryPresent((*elem).name))
{
return false;
}
}
}
10.7 Case1
加载 Schema\WoWLookSkin.scheme.xml
10.8 窗口布局
|