Toast Engine
Loading...
Searching...
No Matches
settings.hpp File Reference
#include <array>
#include <cstdint>
#include <deque>
#include <filesystem>
#include <functional>
#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <toast/export.hpp>
#include <unordered_map>
#include <variant>
#include <vector>
Include dependency graph for settings.hpp:

Go to the source code of this file.

Classes

struct  toast::settings::Meta
 Everything the editor needs to render a setting without knowing what it is. More...
struct  toast::settings::Entry
 One registered setting. Held by the registry; Setting<T> is a handle to it. More...
class  toast::settings::Settings
 The engine-wide settings registry. More...
class  toast::settings::Setting< T >
 Typed handle to a declared setting. More...

Typedefs

using toast::settings::Value = std::variant<bool, int64_t, double, std::string>

Enumerations

enum class  toast::settings::Type : uint8_t { boolean , integer , floating , string }
 Storage type of a setting; the editor picks its widget from this.
enum class  toast::settings::Layer : uint8_t { code , project , user }
 Where a value comes from, lowest priority first. More...

Functions

auto toast::settings::declareBool (std::string_view key, bool default_value, Meta meta={}) -> Setting< bool >
 declare* wrappers returning a typed handle, which is what call sites actually want
auto toast::settings::declareInt (std::string_view key, int64_t default_value, Meta meta={}) -> Setting< int64_t >
auto toast::settings::declareFloat (std::string_view key, double default_value, Meta meta={}) -> Setting< double >
auto toast::settings::declareString (std::string_view key, std::string default_value, Meta meta={}) -> Setting< std::string >

Variables

constexpr size_t toast::settings::k_layer_count = 2
 Writable layers; code lives in Entry::default_value.

Detailed Description

Author
dario
Date
16/08/2026

Enumeration Type Documentation

◆ Layer

enum class toast::settings::Layer : uint8_t
strong

Where a value comes from, lowest priority first.

code is the default passed to declare() and is never written to disk. project is authored in the editor and ships with the game. user is what a player's own tweaks land in, so a patch that changes a project default still reaches players who never touched that setting

A resolved value is the highest layer that has an override, so writing one layer never destroys another