- The last version (0.6.0) was built against SFML@698f265 (and is incompatible with most other SFML versions!).
- A successor is being worked on, which will be published if/when sufficiently matured.
Original (upstream) author: Alexandre Bodelot [email protected]
License: MIT License (See the LICENSE
file.)
- Adapted to the upcoming SFML v3 API
- Richer, more flexible API, new features, improvements, bugfixes
- Default quick-start assets included (and removed the non-free ones)
- Windows build (MSVC & GCC (via w64devkit, so MingW should also work))
- Auto download & setup the latest SFML-master locally (mostly for GitHub workflows)
- Requires some C 23 features (e.g. std::expected)
- Moderately sized package with no external dependencies beyond SFML
- Simple, but versatile API
- Visual styling via spritesheets (small image files to customize borders, markers etc.)
- Optional callbacks for widget updates (supporting both
[]()
and[](Widget*)
lambda signatures) (Other event handlers can also be overridden via inheritance.) - Easy layouts: automatically (and dynamically re)positioned/sized widgets
- Translucent wallpapers, tooltips
- No CMake. (Well, since I never got to learn it, I just declare this a feature now. ;) Use e.g. TGUI if you don't feel warm and cozy without CMake.)
- Run
build
on Windows, ormake
on Linux, to create the lib the example/demo/test executables. - MSVC and GCC (both on Linux and w64devkit/MinGW) are auto-detected. (CLANG support has kinda rotted away by now.)
- The GCC option supports header auto-dependency tracking yet. (No working
clean
rule currently: deletetmp/build
and the lib binaries underlib/
)
(See the Makefiles for options.)
- Integrate (via env. vars, or just copy) the
include
&lib
dirs to your project. (Copy theasset
dir, too, if you want to use the stock defaults.) #include "sfw/GUI.hpp"
.- Optionally (but typically) customize the theme: the styling texture image, font, colors etc.
- Create the top-level GUI manager object, connecting it to your SFML window (like:
sfw::GUI myGUI(window);
), usually with your custom theme config (sfw::GUI myGUI(window, myConfig);
) - Add containers (layouts) and widgets with
add(sfw::SomeWidget(...))
, or if you prefer:add(new sfw::OtherWidget)
calls, set their properties (typically with method chaining, likeadd(new TextBox)->set("hi")->setCallback(...)
) etc. Note: widget objects will be managed (e.g. deleted) implicitly. - Pass events to the GUI (in your app's event loop):
myGUI.process(event);
. - Draw the GUI (in your frame refresh loop; i.e. the event loop in single-treaded apps):
myGUI.render();
. - Have fun!
- a minimal example
- a fairly comprehensive example:
demo.cpp
- see the headers in the
include
dir for an authoritative reference (most of them are easy to read)