Platformer
Platformer
|
This class manages the resources of our game as a singleton. More...
#include <ResourceManager.hpp>
Public Member Functions | |
void | shutdown () |
Shuts down the ResourceManager, removing all its references to loaded resources. | |
std::shared_ptr< SDLTextureWrapper > | LoadImage (const std::string &path) |
Loads an image from the given path Uses the stored image if already loaded. More... | |
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. More... | |
ResourceManager (const ResourceManager &m)=delete | |
Stop the compiler from generating methods to copy the object. | |
void | operator= (const ResourceManager &m)=delete |
Stop the compiler from generating methods to copy the object. | |
Static Public Member Functions | |
static ResourceManager & | instance () |
The singleton instance of the ResourceManager. | |
static std::shared_ptr< SDLSoundWrapper > | LoadSound (const std::string &path) |
Loads a sound from the given path Uses the stored sound if already loaded. More... | |
Private Member Functions | |
ResourceManager () | |
Constructs a ResourceManager. | |
~ResourceManager () | |
Constructs a ResourceManager. | |
Private Attributes | |
std::unordered_map< std::string, std::shared_ptr< SDLTextureWrapper > > | loadedImages |
Map of all currently loaded images. | |
std::unordered_map< std::string, std::shared_ptr< SDLFontWrapper > > | loadedFonts |
Map of all currently loaded fonts. | |
std::unordered_map< std::string, std::shared_ptr< SDLSoundWrapper > > | loadedSounds |
Map of all currently loaded sounds. | |
This class manages the resources of our game as a singleton.
std::shared_ptr< SDLFontWrapper > ResourceManager::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.
path | The path of the font |
textSize | The text size of the font |
std::shared_ptr< SDLTextureWrapper > ResourceManager::LoadImage | ( | const std::string & | path | ) |
Loads an image from the given path Uses the stored image if already loaded.
path | The path of the image |
|
static |
Loads a sound from the given path Uses the stored sound if already loaded.
path | The path of the sound |