Manifest-driven cache for sf::Font resources.
More...
#include <FontManager.h>
Static Public Member Functions | |
| static const sf::Font & | get (const Asset &asset) |
| Retrieve the cached resource for an asset enum value. | |
| static const sf::Font & | getDefault () |
| Return the built-in Arial font. | |
| static void | unload (Asset asset) |
| Remove a resource from the cache. | |
Manifest-driven cache for sf::Font resources.
FontManager<Manifest> extends ResourceManager to provide lazy-loaded, cached access to fonts declared in a manifest's Fonts enum. It also provides getDefault(), which returns a built-in Arial font that is always available without any manifest registration.
FontManager defaults to DefaultManifest so it can be used without a custom manifest when only the built-in font is needed:
| Manifest | A Manifest subclass with a Fonts enum whose values map to font file paths. Defaults to DefaultManifest when no custom fonts are needed. |
Definition at line 45 of file FontManager.h.
|
staticinherited |
Retrieve the cached resource for an asset enum value.
Loads and caches on first access. Throws std::runtime_error if the path is not registered or loading fails.
| Asset | An enum type declared inside Manifest. |
| asset | The specific enum value to load. |
Resource.
|
static |
Return the built-in Arial font.
The Arial font is embedded in the framework and requires no manifest registration or file path. Use it as a reliable fallback for UI text when no custom font has been loaded.
sf::Font.
|
staticinherited |
Remove a resource from the cache.
The next get(asset) call will reload from disk. If called during draw(), the unload is deferred until after the frame completes to prevent mid-frame dangling references.
| Asset | The enum type of the key to remove. |
| asset | The specific enum value to evict from the cache. |