1 #ifndef RESOURCE_MANAGER_HPP     2 #define RESOURCE_MANAGER_HPP     6 #include <unordered_map>     8 #include "SDLFontWrapper.hpp"     9 #include "SDLSoundWrapper.hpp"    10 #include "SDLTextureWrapper.hpp"    30   std::shared_ptr<SDLTextureWrapper> 
LoadImage(
    31                                                const std::string& path);
    38   std::shared_ptr<SDLFontWrapper> 
LoadFont(
    39                                            const std::string& path,
    48   static std::shared_ptr<SDLSoundWrapper> 
LoadSound(
    49                                                     const std::string& path);
    65   std::unordered_map<std::string, std::shared_ptr<SDLTextureWrapper>>
    69   std::unordered_map<std::string, std::shared_ptr<SDLFontWrapper>> 
loadedFonts;
    72   std::unordered_map<std::string, std::shared_ptr<SDLSoundWrapper>>
 static ResourceManager & instance()
The singleton instance of the ResourceManager. 
Definition: ResourceManager.cpp:9
 
std::unordered_map< std::string, std::shared_ptr< SDLTextureWrapper > > loadedImages
Map of all currently loaded images. 
Definition: ResourceManager.hpp:66
 
void operator=(const ResourceManager &m)=delete
Stop the compiler from generating methods to copy the object. 
 
static std::shared_ptr< SDLSoundWrapper > LoadSound(const std::string &path)
Loads a sound from the given path Uses the stored sound if already loaded. 
Definition: ResourceManager.cpp:67
 
~ResourceManager()
Constructs a ResourceManager. 
Definition: ResourceManager.cpp:7
 
ResourceManager()
Constructs a ResourceManager. 
Definition: ResourceManager.cpp:5
 
This class manages the resources of our game as a singleton. 
Definition: ResourceManager.hpp:16
 
std::shared_ptr< SDLTextureWrapper > LoadImage(const std::string &path)
Loads an image from the given path Uses the stored image if already loaded. 
Definition: ResourceManager.cpp:26
 
std::shared_ptr< SDLFontWrapper > LoadFont(const std::string &path, int textSize)
Loads a font from the given path in the given textSize Uses the stored font if already loaded...
Definition: ResourceManager.cpp:49
 
std::unordered_map< std::string, std::shared_ptr< SDLFontWrapper > > loadedFonts
Map of all currently loaded fonts. 
Definition: ResourceManager.hpp:69
 
std::unordered_map< std::string, std::shared_ptr< SDLSoundWrapper > > loadedSounds
Map of all currently loaded sounds. 
Definition: ResourceManager.hpp:73
 
void shutdown()
Shuts down the ResourceManager, removing all its references to loaded resources. 
Definition: ResourceManager.cpp:14