4 #include <unordered_map>
7 #include <SDL2/SDL_ttf.h>
31 std::unordered_map<std::string, TTF_Font*>
m_fontMap;
85 SDL_Texture*
loadText(std::string font_path, std::string text, SDL_Color color,
int font_size = 20);
Singleton class for managing game resources like textures and fonts.
void setRenderer(SDL_Renderer *renderer)
Sets the renderer for resource management.
SDL_Renderer * m_renderer
Renderer used to render game objects.
SDL_Texture * loadText(std::string font_path, std::string text, SDL_Color color, int font_size=20)
Loads a text as a texture using a specified TTF font.
SDL_Renderer * getRenderer()
Gets the current renderer.
ResourceManager()
Private constructor for singleton pattern.
std::unordered_map< std::string, SDL_Texture * > m_imageResourceMap
Cache of texture resources.
SDL_Texture * loadTexture(std::string path)
Loads a texture from a specified file path.
void operator=(const ResourceManager &)=delete
Deleted assignment operator to prevent multiple instances.
static ResourceManager & getInstance()
Retrieves the singleton instance of ResourceManager.
ResourceManager(const ResourceManager &)=delete
Deleted copy constructor to prevent multiple instances.
std::unordered_map< std::string, TTF_Font * > m_fontMap
Cache of font resources.