2D_Game_Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TexturesManager Class Reference

#include <texturesmanager.hpp>

Public Member Functions

 TexturesManager ()=default
 
 ~TexturesManager ()=default
 
std::pair< uint32_t, std::shared_ptr< Texture > > GetTexture (const std::string &path, int mag_filter, int min_filter)
 
std::shared_ptr< TextureGetTexture (uint32_t id)
 
std::pair< uint32_t, std::shared_ptr< SpriteSheet > > GetSpriteSheet (const std::string &path, unsigned int tile_width, unsigned int tile_height, int mag_filter, int min_filter)
 
std::shared_ptr< SpriteSheetGetSpriteSheet (uint32_t id)
 
void ReleaseTexture (uint32_t texture_id)
 
void ReleaseSpriteSheet (uint32_t texture_id)
 
std::pair< uint32_t, std::shared_ptr< Texture > > UpdateTexture (uint32_t texture_id, const std::string &path, int mag_filter, int min_filter)
 
std::pair< uint32_t, std::shared_ptr< SpriteSheet > > UpdateSpriteSheet (uint32_t texture_id, const std::string &path, unsigned int tile_width, unsigned int tile_height, int mag_filter, int min_filter)
 

Detailed Description

Definition at line 21 of file texturesmanager.hpp.

Constructor & Destructor Documentation

◆ TexturesManager()

TexturesManager::TexturesManager ( )
default

◆ ~TexturesManager()

TexturesManager::~TexturesManager ( )
default

Member Function Documentation

◆ GetSpriteSheet() [1/2]

std::pair< uint32_t, std::shared_ptr< SpriteSheet > > TexturesManager::GetSpriteSheet ( const std::string & path,
unsigned int tile_width,
unsigned int tile_height,
int mag_filter,
int min_filter )

Returns a spritesheet from the parameters given. If the spritesheet is already loaded, it will return the spritesheet and increase the number of copies, otherwise it will load the spritesheet and return it.

Returns
A pair with the texture id and the texture itself.

Definition at line 32 of file texturesmanager.cpp.

◆ GetSpriteSheet() [2/2]

std::shared_ptr< SpriteSheet > TexturesManager::GetSpriteSheet ( uint32_t id)

Returns a spritesheet from the id given.

Returns
the spritesheet

Definition at line 49 of file texturesmanager.cpp.

◆ GetTexture() [1/2]

std::pair< uint32_t, std::shared_ptr< Texture > > TexturesManager::GetTexture ( const std::string & path,
int mag_filter,
int min_filter )

Returns a texture from the parameters given. If the texture is already loaded, it will return the texture and increase the number of copies, otherwise it will load the texture and return it.

Returns
A pair with the texture id and the texture itself.

Definition at line 5 of file texturesmanager.cpp.

◆ GetTexture() [2/2]

std::shared_ptr< Texture > TexturesManager::GetTexture ( uint32_t id)

Returns a texture from the id given.

Returns
the texture

Definition at line 22 of file texturesmanager.cpp.

◆ ReleaseSpriteSheet()

void TexturesManager::ReleaseSpriteSheet ( uint32_t texture_id)

Decreases the number of copies of the spritesheet with the id given. If the number of copies reaches 0, the spritesheet will be deleted.

Definition at line 71 of file texturesmanager.cpp.

◆ ReleaseTexture()

void TexturesManager::ReleaseTexture ( uint32_t texture_id)

Decreases the number of copies of the texture with the id given. If the number of copies reaches 0, the texture will be deleted.

Definition at line 59 of file texturesmanager.cpp.

◆ UpdateSpriteSheet()

std::pair< uint32_t, std::shared_ptr< SpriteSheet > > TexturesManager::UpdateSpriteSheet ( uint32_t texture_id,
const std::string & path,
unsigned int tile_width,
unsigned int tile_height,
int mag_filter,
int min_filter )

Updates the spritesheet with the id given with the new parameters.

Definition at line 89 of file texturesmanager.cpp.

◆ UpdateTexture()

std::pair< uint32_t, std::shared_ptr< Texture > > TexturesManager::UpdateTexture ( uint32_t texture_id,
const std::string & path,
int mag_filter,
int min_filter )

Updates the texture with the id given with the new parameters.

Definition at line 83 of file texturesmanager.cpp.


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