|
|
auto | declareBool (std::string_view key, bool default_value, Meta meta={}) -> Entry * |
|
auto | declareInt (std::string_view key, int64_t default_value, Meta meta={}) -> Entry * |
|
auto | declareFloat (std::string_view key, double default_value, Meta meta={}) -> Entry * |
|
auto | declareString (std::string_view key, std::string default_value, Meta meta={}) -> Entry * |
| auto | find (std::string_view key) -> Entry * |
| auto | entries () -> std::vector< Entry * > |
| | Every declared setting, in declaration order.
|
| auto | value (std::string_view key) -> std::optional< Value > |
| auto | resolved (const Entry *entry) -> Value |
| auto | setValue (std::string_view key, const Value &value) -> bool |
| | Writes value into the active layer and fires the setting's change callbacks.
|
|
auto | reset (std::string_view key) -> bool |
| | Drops key's override in the active layer, exposing whatever is underneath.
|
|
void | resetAll () |
| | reset() for every declared setting
|
|
void | setPaths (std::filesystem::path project_file, std::filesystem::path user_file) |
| | Points the two writable layers at their files; neither has to exist yet.
|
| void | setActiveLayer (Layer layer) |
| | Which layer setValue() writes to.
|
|
auto | activeLayer () const -> Layer |
| auto | activeFilePath () const -> const std::filesystem::path & |
| void | load () |
| | Reads both writable layers from disk, replacing whatever they currently hold.
|
| auto | save () -> bool |
| | Writes the active layer, creating parent directories as needed.
|
|
auto | dirty () const -> bool |
|
auto | saveIfDirty () -> bool |
| | save(), but only when something changed since the last one
|
The engine-wide settings registry.
Systems declare their own settings next to the code that consumes them and keep the returned handle; nothing central has to know the list. Values arriving from disk before their declaration are held and applied when it happens, so load order does not matter - the renderer declares its settings when it is constructed, long after the files were read
- Note
- Every accessor is mutex-guarded, because the editor sets values from its UI thread while the engine reads them on the main thread. Systems that need a value per frame should cache it through onChange() rather than calling get() in a loop