SDL SPOOKY PLATFORMER ENGINE  0.2.0
An implementation of a platformer using sdl, implemented using an entity component system and efficient collision management.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ResourceManager< Derived, T > Class Template Reference

#include <ResourceManager.hpp>

Public Member Functions

int shutDown ()
 
std::shared_ptr< T > GetResource (const std::string &resourceName)
 
std::shared_ptr< T > Load (const std::string &path)
 
bool AddResource (const std::string &resourceName)
 
bool AddAllResource ()
 

Protected Member Functions

 ResourceManager ()
 
 ResourceManager (ResourceManager const &)
 Allow subclasses to create a resource manager, but subclasses must ensure singleton functionality. More...
 
void operator= (ResourceManager const &)
 Allow subclasses to assign to a resource manager, but subclasses must ensure singleton functionality. More...
 

Protected Attributes

std::map< std::string, std::pair< std::shared_ptr< T >, int > > resourceMap
 Internal resource mapping inherited by manager implementations. More...
 
std::map< std::string, std::string > fileMap
 stores location of resources More...
 

Detailed Description

template<typename Derived, class T>
class ResourceManager< Derived, T >

abstract implementation of a resource manager. Ensures that a resource is only loaded from disk once. Subclasses implement how a resource is loaded.

Constructor & Destructor Documentation

template<typename Derived , class T >
ResourceManager< Derived, T >::ResourceManager ( )
inlineprotected
template<typename Derived , class T >
ResourceManager< Derived, T >::ResourceManager ( ResourceManager< Derived, T > const &  )
protected

Allow subclasses to create a resource manager, but subclasses must ensure singleton functionality.

Allow subclasses to copy a resource manager, but subclasses must ensure singleton functionality

Member Function Documentation

template<typename Derived , class T >
bool ResourceManager< Derived, T >::AddAllResource ( )
inline

Convenience method for loading all resources this resource manager knows about.

template<typename Derived , class T >
bool ResourceManager< Derived, T >::AddResource ( const std::string &  resourceName)
inline

Tell the resource manager to load in a given resource. Note that until told, a resource manager is aware of all the possible assets it may be asked to load, but none are actually loaded.

Parameters
resourceNamethe colloquial name, identified in individual resource managers.
template<typename Derived , class T >
std::shared_ptr<T> ResourceManager< Derived, T >::GetResource ( const std::string &  resourceName)
inline

Get a resource by its colloquial name.

Parameters
resourceNamethe colloquial name, identified in individual resource managers.
template<typename Derived , class T >
std::shared_ptr<T> ResourceManager< Derived, T >::Load ( const std::string &  path)
inline

Load a texture from file.

Parameters
paththe filename.
template<typename Derived , class T >
void ResourceManager< Derived, T >::operator= ( ResourceManager< Derived, T > const &  )
protected

Allow subclasses to assign to a resource manager, but subclasses must ensure singleton functionality.

template<typename Derived , class T >
int ResourceManager< Derived, T >::shutDown ( )
inline

Shuts down the resource manager.

Member Data Documentation

template<typename Derived , class T >
std::map<std::string, std::string> ResourceManager< Derived, T >::fileMap
protected

stores location of resources

template<typename Derived , class T >
std::map<std::string, std::pair<std::shared_ptr<T>, int> > ResourceManager< Derived, T >::resourceMap
protected

Internal resource mapping inherited by manager implementations.


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