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

Singleton responisble for loading and retrieving textures. More...

#include <TextureManager.h>

Collaboration diagram for TextureManager:
Collaboration graph

Public Types

enum class  DefaultTextures {
  WHITE , BLACK , RED , GREEN , BLUE ,
  STITCH
}
 Collection of Preloaded Textures. More...
 

Static Public Member Functions

static void LoadTexture (const MapKey &key, const std::string &path)
 Load Texture with KEY and FILE PATH.
 
static void LoadTexture (const MapKey &key, const unsigned char &red, const unsigned char &green, const unsigned char &blue, const unsigned char &alpha=unsigned char(255))
 Load Texture with KEY and RGB VALUE.
 
static void LoadTexture (const MapKey &key, const Vect &color)
 Load Texture with KEY and VECT.
 
static Texture * GetTexture (const MapKey &key)
 Returns texture pointer with given KEY.
 
static Texture * GetTexture (DefaultTextures key)
 Returns texture pointer from DEFAULTTEXTURES.
 

Private Types

using MapKey = std::string
 KEYS stored as STRINGS.
 

Detailed Description

Singleton responisble for loading and retrieving textures.

Member Typedef Documentation

◆ MapKey

using TextureManager::MapKey = std::string
private

KEYS stored as STRINGS.

Member Enumeration Documentation

◆ DefaultTextures

Collection of Preloaded Textures.

Consists of single color textures as well as an texture for Stitch. <\summary>

Enumerator
WHITE 
BLACK 
RED 
GREEN 
BLUE 
STITCH 

Member Function Documentation

◆ GetTexture() [1/2]

static Texture * TextureManager::GetTexture ( const MapKey & key)
static

Returns texture pointer with given KEY.

A function that returns a texture pointer based on a user generated key. Checks if key already exists.

Parameters
key
Returns
Texture*

◆ GetTexture() [2/2]

static Texture * TextureManager::GetTexture ( DefaultTextures key)
static

Returns texture pointer from DEFAULTTEXTURES.

A function that returns a texture pointer based on the enum class DefaultTextures.

Parameters
key
Returns
Texture*

◆ LoadTexture() [1/3]

static void TextureManager::LoadTexture ( const MapKey & key,
const std::string & path )
static

Load Texture with KEY and FILE PATH.

A function callable in SlippersResources/LoadResources that takes in a String as a key for retrieval, as well as a file path for a texture existing in Assets/Textures. Checks for repeated key use.

Parameters
key
path

◆ LoadTexture() [2/3]

static void TextureManager::LoadTexture ( const MapKey & key,
const unsigned char & red,
const unsigned char & green,
const unsigned char & blue,
const unsigned char & alpha = unsigned char(255) )
static

Load Texture with KEY and RGB VALUE.

A function callable in SlippersResources/LoadResources that takes in a String as a key for retrieval, as well as an R, G, B, and A value to be used to create a single color texture. Checks for repeated key use.

Parameters
key
red
green
blue
alpha

◆ LoadTexture() [3/3]

static void TextureManager::LoadTexture ( const MapKey & key,
const Vect & color )
static

Load Texture with KEY and VECT.

A function callable in SlippersResources/LoadResources that takes in a String as a key for retrieval, as well as a vector value to be used to create a single color texture. Checks for repeated key use.

Parameters
key
color