|
| static void | ensureInitialized () |
| | Ensure the manifest's config values have been registered.
|
| template<typename M = Manifest> |
| static std::enable_if_t< has_Booleans< M >::value, bool > | get (typename M::Booleans config) |
| | Retrieve a boolean config value.
|
| template<typename M = Manifest> |
| static std::enable_if_t< has_Floats< M >::value, float > | get (typename M::Floats config) |
| | Retrieve a float config value.
|
| template<typename M = Manifest> |
| static std::enable_if_t< has_Ints< M >::value, int > | get (typename M::Integers config) |
| | Retrieve an integer config value.
|
| template<typename M = Manifest> |
| static std::enable_if_t< has_Strings< M >::value, const std::string & > | get (typename M::Text config) |
| | Retrieve a string config value.
|
template<typename
Manifest>
class ml::ConfigManager< Manifest >
Manifest-driven accessor for typed configuration values.
ConfigManager<Manifest> provides typed get() overloads for each configuration enum declared in a manifest. Each overload is enabled only when the corresponding enum exists, so missing config types are caught at compile time.
Manifest config enums
| Enum name in manifest | Value type | Example |
Text | std::string | Window title, labels |
Ints | int | Max players, tile size |
Floats | float | Speed multiplier, volume |
Booleans | bool | Debug mode, fullscreen |
Usage
public:
enum class Text { Title };
enum class Ints { MaxPlayers };
enum class Floats { Speed };
private:
inline static const auto _ = [](){
set(Text::Title, std::string(
"My Game"));
set(Ints::MaxPlayers, 4);
set(Floats::Speed, 1.5f);
return 0;
}();
};
static std::enable_if_t< has_Strings< M >::value, const std::string & > get(typename M::Text config)
Retrieve a string config value.
Base class for all Malena manifests.
static void set(EnumType key, const char *filepath)
Register an asset file path.
A framework-integrated text object with word-wrap support.
Or more conveniently via Context:
const std::string& title = MyCtx::ConfigMgr::get(MyManifest::Text::Title);
Combines AssetsManager, ConfigManager, and StateManager for a manifest into one convenience struct.
- Template Parameters
-
- See also
- Manifest, Context, AssetsManager
Definition at line 88 of file ConfigManager.h.