dBTheme::dBTheme() { resourceCache.Init(); pThemeConfig = MFIni::Create("theme:theme"); MFDebug_Assert(pThemeConfig, "Couldn't load theme theme.ini"); MFIniLine *pLine = pThemeConfig->GetFirstLine(); while(pLine) { if(pLine->IsSection("Theme")) { MFIniLine *pSub = pLine->Sub(); while(pSub) { if(pSub->IsString(0, "name")) { pThemeName = pSub->GetString(1); } else if(pSub->IsString(0, "startscreen")) { pStartScreen = pSub->GetString(1); } pSub = pSub->Next(); } } else if(pLine->IsSection("Resources")) { LoadResources(pLine->Sub(), &resourceCache); } else if(pLine->IsSection("Metrics")) { } pLine = pLine->Next(); } }
dBThemeScreen::dBThemeScreen(const char *pScreenName, dBTheme *_pTheme) { pTheme = _pTheme; resourceCache.Init(); entityPool.Init(this); actionManager.Init(this); pThemeScreen = MFIni::Create(pScreenName); MFDebug_Assert(pThemeScreen, MFStr("Couldn't load screen '%s'", pScreenName)); MFIniLine *pLine = pThemeScreen->GetFirstLine(); while(pLine) { if(pLine->IsSection("Screen")) { MFIniLine *pSLine = pLine->Sub(); while(pSLine) { if(pSLine->IsString(0, "name")) { pScreenName = pSLine->GetString(1); } else if(pSLine->IsString(0, "selection")) { // default selected entity } else if(pSLine->IsString(0, "clearcolour")) { clearColour = pSLine->GetVector4(1); } else if(pSLine->IsSection("Resources")) { LoadResources(pSLine->Sub(), &resourceCache); } else if(pSLine->IsSection("Metrics")) { MFIniLine *pSub = pSLine->Sub(); while(pSub) { dBThemeMetric &metric = metrics.push(); metric.pName = pSub->GetString(0); metric.pMetric = actionManager.ParseMetric(pSub->GetString(1)); pSub = pSub->Next(); } } else if(pSLine->IsSection("Actions")) { MFIniLine *pSub = pSLine->Sub(); while(pSub) { dBThemeAction &action = actions.push(); action.pName = pSub->GetString(0); action.pScript = actionManager.ParseScript(pSub->GetString(1)); pSub = pSub->Next(); } } else if(pSLine->IsSection("Entities")) { MFIniLine *pSub = pSLine->Sub(); while(pSub) { if(pSub->IsString(0, "section")) { MFIniLine *pEntity = pSub->Sub(); while(pEntity) { if(pEntity->IsString(0, "name")) { dBEntity *pNewEntity = entityPool.Create(pSub->GetString(1), pEntity->GetString(1)); pNewEntity->Init(&actionManager, pSub->Sub()); break; } pEntity = pEntity->Next(); } } pSub = pSub->Next(); } } pSLine = pSLine->Next(); } } pLine = pLine->Next(); } // init all the entities dBEntity *pE = NULL; while(pE = entityPool.Iterate(pE)) { pE->SignalEvent("init", NULL); } }