Ketchup Engine
Loading...
Searching...
No Matches
TextureManager Class Reference

#include <TextureManager.h>

Collaboration diagram for TextureManager:
Collaboration graph

Public Types

using MapKey = std::string
 
using StorageMap = std::unordered_map< MapKey, Texture * >
 

Static Public Member Functions

static void Load (MapKey k, const char *path)
 Loads a Texture from path and associates it with Key k.
 
static void Load (MapKey k, unsigned char r, unsigned char g, unsigned char b, unsigned char alpha=255)
 Creates a single-pixel texture of the color specified and associates it with Key k.
 
static Texture * Get (MapKey k)
 Gets the Texture associated with the given MapKey.
 

Private Member Functions

 TextureManager ()=default
 
 TextureManager (const TextureManager &)=delete
 
TextureManageroperator= (const TextureManager &)=delete
 
 ~TextureManager ()
 

Static Private Member Functions

static TextureManagerInstance ()
 
static void Free ()
 

Private Attributes

std::unordered_map< std::string, Texture * > m_images
 

Static Private Attributes

static TextureManagerp_instance
 

Friends

class TextureManagerAttorney
 

Member Typedef Documentation

◆ MapKey

using TextureManager::MapKey = std::string

◆ StorageMap

using TextureManager::StorageMap = std::unordered_map<MapKey, Texture*>

Constructor & Destructor Documentation

◆ TextureManager() [1/2]

TextureManager::TextureManager ( )
privatedefault

◆ TextureManager() [2/2]

TextureManager::TextureManager ( const TextureManager )
privatedelete

◆ ~TextureManager()

TextureManager::~TextureManager ( )
private

Member Function Documentation

◆ Free()

void TextureManager::Free ( )
staticprivate

◆ Get()

Texture * TextureManager::Get ( MapKey  k)
static

Gets the Texture associated with the given MapKey.

Haru, 3/8/2023.

Parameters
kThe MapKey (string).
Returns
A pointer to the Texture.

◆ Instance()

TextureManager * TextureManager::Instance ( )
staticprivate

◆ Load() [1/2]

void TextureManager::Load ( MapKey  k,
const char *  path 
)
static

Loads a Texture from path and associates it with Key k.

Haru, 3/8/2023.

Parameters
kA MapKey (string) to associate the texture with.
pathPathname of the file.

◆ Load() [2/2]

void TextureManager::Load ( MapKey  k,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  alpha = 255 
)
static

Creates a single-pixel texture of the color specified and associates it with Key k.

Haru, 3/8/2023.

Parameters
kA MapKey (string) to associate the texture with.
rRed component of the color.
Parameters
gGreen component of the color.
Parameters
bBlue component of the color.
Parameters
alphaAlpha component of the color.

◆ operator=()

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

Friends And Related Function Documentation

◆ TextureManagerAttorney

friend class TextureManagerAttorney
friend

Member Data Documentation

◆ m_images

std::unordered_map<std::string, Texture*> TextureManager::m_images
private

◆ p_instance

TextureManager * TextureManager::p_instance
staticprivate

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