Loading...
Searching...
No Matches
AssetsManager.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave Smith on 10/3/25.
6//
7
8#ifndef MALENA_ASSETSMANAGER_H
9#define MALENA_ASSETSMANAGER_H
10
16
17namespace ml
18{
20
22 template<typename T, typename = void>
23 struct has_Image : std::false_type {};
24 template<typename T>
25 struct has_Image<T, std::void_t<typename T::Images>> : std::true_type {};
26
28 template<typename T, typename = void>
29 struct has_Font : std::false_type {};
30 template<typename T>
31 struct has_Font<T, std::void_t<typename T::Fonts>> : std::true_type {};
32
34 template<typename T, typename = void>
35 struct has_Sound : std::false_type {};
36 template<typename T>
37 struct has_Sound<T, std::void_t<typename T::Sounds>> : std::true_type {};
38
40
92 template<typename Manifest>
94 {
95 private:
96 using TextureMgr = TextureManager<Manifest>;
97 using FontMgr = FontManager<Manifest>;
98 using SoundMgr = SoundManager<Manifest>;
99
100 public:
109 template<typename M = Manifest>
110 static std::enable_if_t<has_Image<M>::value, const sf::Texture&>
111 get(typename M::Images image);
112
121 template<typename M = Manifest>
122 static std::enable_if_t<has_Font<M>::value, const sf::Font&>
123 get(typename M::Fonts font);
124
133 template<typename M = Manifest>
134 static std::enable_if_t<has_Sound<M>::value, const sf::SoundBuffer&>
135 get(typename M::Sounds sound);
136
145 template<typename M = Manifest>
146 static std::enable_if_t<has_Font<M>::value, const sf::Font&>
148 };
149
150} // namespace ml
151
152#include "../../../src/Resources/AssetsManager.tpp"
153#endif // MALENA_ASSETSMANAGER_H
Unified asset accessor for textures, fonts, and sound buffers.
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_Sound< M >::value, const sf::SoundBuffer & > get(typename M::Sounds sound)
Retrieve a cached sf::SoundBuffer by manifest enum value.
static std::enable_if_t< has_Font< M >::value, const sf::Font & > getDefaultFont()
Return the built-in Arial font.
static std::enable_if_t< has_Font< M >::value, const sf::Font & > get(typename M::Fonts font)
Retrieve a cached sf::Font by manifest enum value.
Manifest-driven cache for sf::Font resources.
Definition FontManager.h:47
Manifest-driven cache for sf::SoundBuffer resources.
Manifest-driven cache for sf::Texture resources.
Definition Component.h:22