Jagguar Game Engine

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ResourceManager Class Reference

`#include <ResourceManager.hpp>`

## Public Member Functions
SDL_Surface * | LoadResource (std::string image_filename)
SDL_Surface * | GetResource (std::string key)
int | StartUp ()
int | ShutDown ()

## Static Public Member Functions
static ResourceManager & | GetInstance ()

## Private Member Functions
| ResourceManager ()
| ResourceManager (ResourceManager const &)
void | operator= (ResourceManager const &)

## Private Attributes
std::unordered_map< std::string, SDL_Surface * > | surfaces

## Detailed Description

A Singleton class to hold all loaded files in the game. The purpose of the ResourceManager is to avoid wasting memory on duplicate textures, audio files, and any other things that need to be loaded.

## Constructor & Destructor Documentation

## ◆ ResourceManager()

ResourceManager::ResourceManager | ( |  | ) |
| private

Construct a new Resource Manager object. Not used, according to the Singleton Pattern.

Here is the caller graph for this function:

## Member Function Documentation

## ◆ GetInstance()

ResourceManager & ResourceManager::GetInstance | ( |  | ) |
| static

Get the Singleton instance of the ResourceManager.

Returns
  the only ResourceManager instance

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ GetResource()

SDL_Surface * ResourceManager::GetResource | ( | std::string | key | ) |

Get a resource from the ResourceManager. If the resource is not already loaded, calls LoadResource()

Parameters

  key | the filename to be loaded

Returns
  the SDL_Surface created by loading the file

Here is the caller graph for this function:

## ◆ LoadResource()

SDL_Surface * ResourceManager::LoadResource | ( | std::string | image_filename | ) |

Load a file into memory.

Parameters

  image_filename | the name of the file to be loaded

Returns
  the SDL_Surface created by loading the file

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ ShutDown()

int ResourceManager::ShutDown | ( |  | ) |

Destroy the Singleton

## ◆ StartUp()

int ResourceManager::StartUp | ( |  | ) |

Initialize the Singleton.

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

- include/ResourceManager.hpp
- src/ResourceManager.cpp