|
MochiEngine
|
This class must be inherited to generate textures of a compatible type with its own renderer. More...
#include <AbstractTextureFactory.h>
Public Member Functions | |
| std::shared_ptr< ITexture > | GetTexture (const std::string &texturePath) |
| Gets the texture on the specified path on the file system. If the texture is in the cache it returns that one, otherwise it loads the texture from the system. | |
| void | DeleteCache () |
| Deletes the texture cache from the factory. | |
| void | DeleteTexture (const std::string &texturePath) |
| Deletes a single texture from the cache. | |
Protected Member Functions | |
| virtual std::shared_ptr< ITexture > | LoadTexture (const std::string &texturePath)=0 |
| Implement this method to actually load the selected texture from memory onto a format that is compatible with the current renderer. | |
Protected Attributes | |
| std::unordered_map< std::string, std::shared_ptr< ITexture > > | mTexturesMap |
This class must be inherited to generate textures of a compatible type with its own renderer.
Ownership:
Guarantees:
| void Mochi::Graphics::AbstractTextureFactory::DeleteCache | ( | ) |
Deletes the texture cache from the factory.
Clears the textures map, releasing all textures that don't have a reference in any other place. Is safe to call whenever.
| void Mochi::Graphics::AbstractTextureFactory::DeleteTexture | ( | const std::string & | texturePath | ) |
Deletes a single texture from the cache.
Removes a texture from the cache, releasing it if it doesn't have any reference in any other place. Is safe to call whenever.
| texturePath | The texture to remove from the cache. |
| texturePath | Path to the texture inside the catalog. |
| std::shared_ptr< ITexture > Mochi::Graphics::AbstractTextureFactory::GetTexture | ( | const std::string & | texturePath | ) |
Gets the texture on the specified path on the file system. If the texture is in the cache it returns that one, otherwise it loads the texture from the system.
| texturePath | The path or unique identifier. |
|
protectedpure virtual |
Implement this method to actually load the selected texture from memory onto a format that is compatible with the current renderer.
| texturePath | The path of the texture in the virtual file system. |
Implemented in Mochi::Graphics::DummyTextureFactory, and Mochi::Graphics::SDLTextureFactory.