I read this on your blog
Thinking about a new design...
// Load one theme that is shared between widgets
tgui::Theme theme{"Black.conf"};
// Create widgets based on that theme
auto button = tgui::Button::create(theme);
// Change the theme for all connected widgets on the fly
theme->changeProperty("Button", "TextColorNormal", "(200, 200, 200)");
Wow, this sounds good. What would happen if I create an element with a theme object and later I want to change a property on this element only? Reminds me a little of the setGlobalTextSize() issues.
A short user story how I use tgui:
I have several game states (startup, main menu, game lobby, game room, ..). No two states can be active at the same time. I share a global tgui::gui between all states. When a new state is transitioned into, all widgets get removed from the global tgui::gui and the specific state widgets get reloaded.
Each state has it's own gui elements and it's own theme.conf. On state creation I load everything with element::create("myState.conf") and hide() and show() and connect() accordingly. Then on some elements, I change properties via getRenderer() because I didn't want an extra theme.conf for a single Button. Sometimes gui elements need to be created dynamically. That is, when game objects offer to be configured. These objects have a tgui::Widget::Ptr getConfigWidget() interface and the state loops over the objects to get the widgets and add them to the tgui::gui.