Loading...
Searching...
No Matches
ml::Context< Manifest > Struct Template Reference

Combines AssetsManager, ConfigManager, and StateManager for a manifest into one convenience struct. More...

#include <Context.h>

Inheritance diagram for ml::Context< Manifest >:

Public Types

using AssetMgr = AssetsManager<Manifest>
 AssetsManager typed to this manifest — access textures, fonts, sounds.
using ConfigMgr = ConfigManager<Manifest>
 ConfigManager typed to this manifest — access string/int/float/bool config.
using StateMgr = StateManager<Manifest>
 StateManager typed to this manifest — access the manifest's State enum.

Detailed Description

template<typename Manifest>
struct ml::Context< Manifest >

Combines AssetsManager, ConfigManager, and StateManager for a manifest into one convenience struct.

Context<Manifest> is the highest-level manifest grouping. It also inherits ManifestAliases so that inner enum types (Images, Fonts, Sounds, State, Flags) are accessible without full qualification.

When to use Context

Use Context when a class or plugin needs both media assets (textures, fonts, sounds) and configuration values (strings, ints, floats, bools):

struct MyContext : public ml::Context<MyManifest>
{
void setup()
{
// Assets
auto& tex = AssetMgr::get(Images::Background);
auto& fnt = AssetMgr::get(Fonts::Main);
// Config
auto& title = ConfigMgr::get(MyManifest::Text::WindowTitle);
}
};
static std::enable_if_t< has_Image< M >::value, const sf::Texture & > get(typename M::Images image)
Retrieve a cached sf::Texture by manifest enum value.
static std::enable_if_t< has_Strings< M >::value, const std::string & > get(typename M::Text config)
Retrieve a string config value.
Combines AssetsManager, ConfigManager, and StateManager for a manifest into one convenience struct.
Definition Context.h:60

Choosing the right level

You need Use
One asset type only TextureManager / FontManager / SoundManager directly
Multiple media types AssetsManager<Manifest>
Media + configuration Context<Manifest> (this struct)
Template Parameters
ManifestA Manifest subclass declaring the resource and config enums.
See also
AssetsManager, ConfigManager, StateManager, ManifestAliases

Definition at line 59 of file Context.h.

Member Typedef Documentation

◆ AssetMgr

template<typename Manifest>
using ml::Context< Manifest >::AssetMgr = AssetsManager<Manifest>

AssetsManager typed to this manifest — access textures, fonts, sounds.

Definition at line 62 of file Context.h.

◆ ConfigMgr

template<typename Manifest>
using ml::Context< Manifest >::ConfigMgr = ConfigManager<Manifest>

ConfigManager typed to this manifest — access string/int/float/bool config.

Definition at line 65 of file Context.h.

◆ StateMgr

template<typename Manifest>
using ml::Context< Manifest >::StateMgr = StateManager<Manifest>

StateManager typed to this manifest — access the manifest's State enum.

Definition at line 68 of file Context.h.


The documentation for this struct was generated from the following file: