Platformer
Platformer
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ResourceManager Class Reference

This class manages the resources of our game as a singleton. More...

#include <ResourceManager.hpp>

Collaboration diagram for ResourceManager:
Collaboration graph

Public Member Functions

void shutdown ()
 Shuts down the ResourceManager, removing all its references to loaded resources.
 
std::shared_ptr< SDLTextureWrapperLoadImage (const std::string &path)
 Loads an image from the given path Uses the stored image if already loaded. More...
 
std::shared_ptr< SDLFontWrapperLoadFont (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 ResourceManagerinstance ()
 The singleton instance of the ResourceManager.
 
static std::shared_ptr< SDLSoundWrapperLoadSound (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.
 

Detailed Description

This class manages the resources of our game as a singleton.

Member Function Documentation

◆ LoadFont()

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.

Returns
The SDLFontWrapper of the font
Parameters
pathThe path of the font
textSizeThe text size of the font
Here is the caller graph for this function:

◆ LoadImage()

std::shared_ptr< SDLTextureWrapper > ResourceManager::LoadImage ( const std::string &  path)

Loads an image from the given path Uses the stored image if already loaded.

Returns
The SDLTextureWrapper of the image
Parameters
pathThe path of the image
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadSound()

std::shared_ptr< SDLSoundWrapper > ResourceManager::LoadSound ( const std::string &  path)
static

Loads a sound from the given path Uses the stored sound if already loaded.

Returns
The SDLSoundWrapper of the sound
Parameters
pathThe path of the sound
Here is the call graph for this function:

The documentation for this class was generated from the following files: