Hi Tank, thanks for making SFGUI, it's really great and made the UI aspects so much easier to handle!
I have attached the theme.txt, where each of the theme IDs are grouped together. I'm loading it using:
desktop.LoadThemeFromFile("theme.txt");
The above part takes maybe 50% of the time (very roughly). Then for each theme ID in that file I call the below SetGenericDesktopSettings for the font size, which takes maybe 25% of the time. I set the font size in the app rather than the .txt file because it can change depending on the player's settings.
SetGenericDesktopSettings(sfg::Desktop& desktop, std::string id)
{
//Widget types
std::vector<std::string> widgets;
widgets.push_back("Button");
widgets.push_back("Label");
widgets.push_back("Frame");
widgets.push_back("Entry");
std::vector<std::string>::iterator itW = widgets.begin();
while(itW != widgets.end())
{
//Set font sizes
std::string fontStr = *itW + "#" + id + *itW;
std::string largeFontStr = *itW + "#" + id + "Large" + *itW;
desktop.SetProperty(fontStr, "FontSize", m_imageM->GetDefaultCharSize());
desktop.SetProperty(largeFontStr, "FontSize", m_imageM->GetDefaultLargeCharSize());
++itW;
}
}
Sorry I can't provide a complete example, the way I load the theme ID strings is a bit more complicated and too large to paste here.