Sly Engine
TextureManager Class Reference

#include <TextureManager.h>

Collaboration diagram for TextureManager:
Collaboration graph

Static Public Member Functions

static Texture * Get (std::string key)
 Gets a texture* using the given key. More...
 
static void Load (std::string key, const char *path)
 Loads the texture. More...
 
static void Load (std::string key, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 Loads the specified color texture. More...
 

Private Types

typedef std::string MapKey
 Defines an alias representing the map key. More...
 
typedef std::map< MapKey, Texture * > StorageMap
 Defines an alias representing the storage map. More...
 

Private Member Functions

 TextureManager ()
 Default constructor. More...
 
 TextureManager (const TextureManager &)=delete
 Copy constructor. More...
 
 TextureManager (TextureManager &&)=delete
 Move constructor. More...
 
TextureManageroperator= (const TextureManager &)=delete
 Assignment operator. More...
 
TextureManageroperator= (TextureManager &&)=delete
 Move assignment operator. More...
 
 ~TextureManager ()=default
 Deconstructor. More...
 
Texture * privGet (std::string key)
 Priv get. More...
 
void privLoad (std::string key, const char *path)
 Priv load. More...
 
void privLoad (std::string key, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 Loads the specified color texture. More...
 
void privDelete ()
 Private delete, delete ptrInstance. More...
 

Static Private Member Functions

static TextureManagerInstance ()
 Gets the instance. More...
 
static void Delete ()
 Deletes the pointer instance. Only to be called internally by Sly. More...
 

Private Attributes

std::string defaultPath
 The default path that Textures are stored at. More...
 
std::map< std::string, Texture * > textureMap
 A map containing a list of textures specified by a key string. More...
 

Static Private Attributes

static TextureManagerptrInstance = nullptr
 Pointer to TextureManager instance. More...
 

Friends

class TextureManagerAttorney
 Dictates access to TextureManager's private functions for engine usuage. More...
 

Member Typedef Documentation

◆ MapKey

std::string TextureManager::MapKey
private

Defines an alias representing the map key.

◆ StorageMap

std::map< MapKey, Texture * > TextureManager::StorageMap
private

Defines an alias representing the storage map.

Constructor & Destructor Documentation

◆ TextureManager() [1/3]

TextureManager::TextureManager ( )
private

Default constructor.

Here is the caller graph for this function:

◆ TextureManager() [2/3]

TextureManager::TextureManager ( const TextureManager )
privatedelete

Copy constructor.

◆ TextureManager() [3/3]

TextureManager::TextureManager ( TextureManager &&  )
privatedelete

Move constructor.

◆ ~TextureManager()

TextureManager::~TextureManager ( )
privatedefault

Deconstructor.

Member Function Documentation

◆ Delete()

static void TextureManager::Delete ( )
inlinestaticprivate

Deletes the pointer instance. Only to be called internally by Sly.

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

◆ Get()

static Texture * TextureManager::Get ( std::string  key)
inlinestatic

Gets a texture* using the given key.

Parameters
keyThe key to get.
Returns
Assertion if it fails, else a pointer to the Texture.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

static TextureManager & TextureManager::Instance ( )
inlinestaticprivate

Gets the instance.

Returns
A reference to TextureManager.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Load() [1/2]

static void TextureManager::Load ( std::string  key,
const char *  path 
)
inlinestatic

Loads the texture.

Parameters
keyThe key.
pathPartial pathname of the file.
Here is the call graph for this function:

◆ Load() [2/2]

static void TextureManager::Load ( std::string  key,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
inlinestatic

Loads the specified color texture.

Parameters
keyThe key.
rRed
gGreen
bBlue
aAlpha
Here is the call graph for this function:

◆ operator=() [1/2]

TextureManager& TextureManager::operator= ( const TextureManager )
privatedelete

Assignment operator.

◆ operator=() [2/2]

TextureManager& TextureManager::operator= ( TextureManager &&  )
privatedelete

Move assignment operator.

◆ privDelete()

void TextureManager::privDelete ( )
private

Private delete, delete ptrInstance.

Here is the caller graph for this function:

◆ privGet()

Texture * TextureManager::privGet ( std::string  key)
private

Priv get.

Parameters
keyThe key.
Returns
Assertion if it fails, else a pointer to the specified Texture.
Here is the caller graph for this function:

◆ privLoad() [1/2]

void TextureManager::privLoad ( std::string  key,
const char *  path 
)
private

Priv load.

Parameters
keyThe key.
pathPartial pathname of the file.
Here is the caller graph for this function:

◆ privLoad() [2/2]

void TextureManager::privLoad ( std::string  key,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
private

Loads the specified color texture.

Parameters
keyThe key.
rRed
gGreen
bBlue
aAlpha

Loads a texture of the specified color

Friends And Related Function Documentation

◆ TextureManagerAttorney

friend class TextureManagerAttorney
friend

Dictates access to TextureManager's private functions for engine usuage.

Member Data Documentation

◆ defaultPath

std::string TextureManager::defaultPath
private

The default path that Textures are stored at.

◆ ptrInstance

TextureManager * TextureManager::ptrInstance = nullptr
staticprivate

Pointer to TextureManager instance.

◆ textureMap

std::map<std::string, Texture*> TextureManager::textureMap
private

A map containing a list of textures specified by a key string.


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