UIHints.h file
Field hints: per-field tweaks to how an editor behaves.
An editor is picked by field type. A hint adjusts it for one field (limits, decimals, units, style class) without writing a new editor.
Hints::Min(0), Hints::Max(100), Hints::Decimals(1), Hints::Units("m/s") // on a field const int places = field.Get(Hints::Decimals, 2); // in an editor
Hints are typed constants, not strings, so:
- a misspelt hint or a wrong value type doesn't compile;
- editors declare which hints they read (EditorRegistry::Register), so a hint the editor ignores is reported with the field's name;
- contradictory hints (Min above Max) are reported the same way;
- each carries a description a tool can list.
Games and plugins declare their own the same way, in their own namespace:
namespace WeaponHints { inline constexpr GGHint<float> Recoil{ "Recoil", "How far a shot kicks, in degrees" }; }
Namespaces
- namespace GGUI
- namespace GGUI::Hints
- Hints read by the built-in editors.
Classes
- struct GGUI::GGHintInfo
- Type-erased part of a hint. Identity is the address of the constant.
- struct GGUI::GGFieldHint
- A hint attached to a field, with its value.
-
template<typename T>struct GGUI::GGHint
- A hint of value type
T:a number type,bool, orstd::string_view. Declared as a constant; its address is its identity.