Major design update for SFGUI:
As I was pretty unhappy about the fact that widgets are only able to render sf::Images (with the "boxing" method), I thought about possible alternatives. And because the library is inspired by GTK, I took another look of how they implemented the rendering separation, namely engines and themes. GTK separetes the look by providing a rendering engine that actually renders the visuals and a theme that modifies various settings in that engine (e.g. colors). The big advantage is: You can modify how widgets look *completely* by switching the engine.
I think getting such a design into SFGUI would be more than neat. My current design is as follows:
The widgets do not render them themselves anymore. Instead they use a rendering engine that encapsulates the rendering. This engine produces sf::Drawables that each widget caches and renders upon redraw. Besides the engine, there're themes just like in GTK: I will provide a basic theme loader that loads in some properties that can be used by the rendering engine. For example -- of course depending on the engine! -- you can adjust colors and special effects here (shadows, animations, w/e).
SFGUI will come with a standard engine called "BREW" that will mostly do what the current "static" rendering in SFGUI also does: Rendering images. However, it will provide more functions like tiling images, stretching them, "boxing" (like it's done at the moment) and using animations.
Rendering engines for SFGUI are of course written in C++. That means if you want to change the look and feel of widgets dramatically, you'll have to provide your own. But for most users this isn't needed, since BREW will already give you enough features to build up your GUI.
Theme files will look like this:
* {
color: #000000;
background-color:#ffffff;
}
Button.States.Normal {
image: button.png;
method: box;
}
Button.States.Hover {
image: button_hover.png;
method: box;
frames: 3;
delay: 100;
}
Editbox {
padding: 5 5;
}
Looks familiar? Right! Most users know how to write CSS, so I chose a similar syntax for themes to make writing them easier and more intuitive than the current implementation. I guess maybe it's also easier for pure designers who're already familiar with CSS.
Phew, much to do, but I'm sure it will pay off. So stay tuned.