xparq / sfw

SFML-based GUI experiment (for my other experiments)
MIT License
2 stars 2 forks source link

UNFINISHED, EXPERIMENTAL, PROTOTYPE-QUALITY CODE!


Build

sfw::GUI - A fork of "SFML Widgets", a small & simple SFML-based GUI

Original (upstream) author: Alexandre Bodelot alexandre.bodelot@gmail.com

License: MIT License (See the LICENSE file.)

Changes to the original:

Main features:

screenshot

Build

(See the Makefiles for options.)

Use

  1. Integrate (via env. vars, or just copy) the include & lib dirs to your project. (Copy the asset dir, too, if you want to use the stock defaults.)
  2. #include "sfw/GUI.hpp".
  3. Optionally (but typically) customize the theme: the styling texture image, font, colors etc.
  4. 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);)
  5. 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, like add(new TextBox)->set("hi")->setCallback(...)) etc. Note: widget objects will be managed (e.g. deleted) implicitly.
  6. Pass events to the GUI (in your app's event loop): myGUI.process(event);.
  7. Draw the GUI (in your frame refresh loop; i.e. the event loop in single-treaded apps): myGUI.render();.
  8. Have fun!

More...