18#ifndef HEADER_STK_TEX_MANAGER_HPP
19#define HEADER_STK_TEX_MANAGER_HPP
21#include "graphics/gl_headers.hpp"
22#include "utils/no_copy.hpp"
31#include <unordered_map>
36 namespace video {
class SColor; }
42 std::unordered_map<std::string, irr::video::ITexture*> m_all_textures;
49 irr::video::ITexture* findTextureInFileSystem(
const std::string& filename,
50 std::string* full_path);
57 irr::video::ITexture* getTexture(
const std::string& path,
58 std::function<
void(irr::video::IImage*)> image_mani =
nullptr);
60 irr::video::ITexture* addTexture(irr::video::ITexture* texture);
62 bool hasTexture(
const std::string& path);
64 bool removeTexture(irr::video::ITexture* texture,
bool remove_all =
false);
66 int dumpTextureUsage();
68 void reloadAllTextures();
81 const std::string &detail=
"");
94 irr::video::ITexture*
getTexture(
const std::string &filename,
95 const std::string &error_message,
96 const std::string &detail=
"")
99 irr::video::ITexture *tex = getTexture(filename);
111 irr::video::ITexture*
getTexture(
const std::string &filename,
116 return getTexture(filename, std::string(error_message),
119 return getTexture(filename, std::string(error_message),
120 std::string(detail));
123 std::unordered_map<std::string, irr::video::ITexture*>& getAllTextures()
124 {
return m_all_textures; }
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: stk_tex_manager.hpp:40
const std::string & getTextureErrorMessage()
Returns the currently defined texture error message, which is used by event_handler....
Definition: stk_tex_manager.hpp:75
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.
Definition: stk_tex_manager.hpp:94
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.
Definition: stk_tex_manager.hpp:111
std::string m_texture_error_message
Additional details to be shown in case that a texture is not found.
Definition: stk_tex_manager.hpp:46
void setTextureErrorMessage(const std::string &error, const std::string &detail="")
Sets an error message to be displayed when a texture is not found.
Definition: stk_tex_manager.cpp:200
void unsetTextureErrorMessage()
Disables the texture error message again.
Definition: stk_tex_manager.hpp:85
Definition: singleton.hpp:87