SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
STKTexManager Class Reference
Inheritance diagram for STKTexManager:
Inheritance graph
[legend]

Public Member Functions

irr::video::ITexture * getTexture (const std::string &path, std::function< void(irr::video::IImage *)> image_mani=nullptr)
 
irr::video::ITexture * addTexture (irr::video::ITexture *texture)
 
bool hasTexture (const std::string &path)
 
bool removeTexture (irr::video::ITexture *texture, bool remove_all=false)
 
int dumpTextureUsage ()
 
void reloadAllTextures ()
 
const std::string & getTextureErrorMessage ()
 Returns the currently defined texture error message, which is used by event_handler.cpp to print additional info about irrlicht internal errors or warnings.
 
void setTextureErrorMessage (const std::string &error, const std::string &detail="")
 Sets an error message to be displayed when a texture is not found.
 
void unsetTextureErrorMessage ()
 Disables the texture error message again.
 
irr::video::ITexture * getTexture (const std::string &filename, const std::string &error_message, const std::string &detail="")
 Convenience function that loads a texture with default parameters but includes an error message.
 
irr::video::ITexture * getTexture (const std::string &filename, char *error_message, char *detail=NULL)
 Convenience function that loads a texture with default parameters but includes an error message.
 
std::unordered_map< std::string, irr::video::ITexture * > & getAllTextures ()
 

Private Member Functions

irr::video::ITexture * findTextureInFileSystem (const std::string &filename, std::string *full_path)
 

Private Attributes

std::unordered_map< std::string, irr::video::ITexture * > m_all_textures
 
std::string m_texture_error_message
 Additional details to be shown in case that a texture is not found.
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< STKTexManager >
static STKTexManagergetInstance ()
 Used to get the instance.
 
static void kill ()
 Used to kill the singleton, if needed.
 
- Protected Member Functions inherited from Singleton< STKTexManager >
 Singleton ()
 Constructor.
 
virtual ~Singleton ()
 Destructor.
 

Member Function Documentation

◆ getTexture() [1/2]

irr::video::ITexture * STKTexManager::getTexture ( const std::string &  filename,
char *  error_message,
char *  detail = NULL 
)
inline

Convenience function that loads a texture with default parameters but includes an error message.

Parameters
filenameFile name of the texture to load.
errorError message, potentially with a '' which will be replaced with detail.
detailString to replace a '' in the error message.

◆ getTexture() [2/2]

irr::video::ITexture * STKTexManager::getTexture ( const std::string &  filename,
const std::string &  error_message,
const std::string &  detail = "" 
)
inline

Convenience function that loads a texture with default parameters but includes an error message.

Parameters
filenameFile name of the texture to load.
errorError message, potentially with a '' which will be replaced with detail.
detailString to replace a '' in the error message.

◆ getTextureErrorMessage()

const std::string & STKTexManager::getTextureErrorMessage ( )
inline

Returns the currently defined texture error message, which is used by event_handler.cpp to print additional info about irrlicht internal errors or warnings.

If no error message is currently defined, the error message is "".

◆ setTextureErrorMessage()

void STKTexManager::setTextureErrorMessage ( const std::string &  error,
const std::string &  detail = "" 
)

Sets an error message to be displayed when a texture is not found.

This error message is shown before the "Texture %s not found or invalid" message. It can be used to supply additional details like what kart is currently being loaded.

Parameters
errorError message, potentially with a '' which will be replaced with detail.
detailString to replace a '' in the error message.

Member Data Documentation

◆ m_texture_error_message

std::string STKTexManager::m_texture_error_message
private

Additional details to be shown in case that a texture is not found.

This is used to specify details like: "while loading kart '...'"


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