X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvideo%2Ftexture_manager.hpp;h=61350fb1643bdcdfa26ad40b84117b1b8b5063c7;hb=eb54891c08ad716431b0c2e8c91ab989946c3ab2;hp=e4047905980d84264ae640100d9c4059cb7446f7;hpb=73259e6cd83bae601cb8ce49b6e7a0df1d4de087;p=supertux.git diff --git a/src/video/texture_manager.hpp b/src/video/texture_manager.hpp index e40479059..61350fb16 100644 --- a/src/video/texture_manager.hpp +++ b/src/video/texture_manager.hpp @@ -23,11 +23,14 @@ #include #include #include +#include #include "video/glutil.hpp" +#include "video/texture_ptr.hpp" class Texture; class GLTexture; +class Rect; class TextureManager { @@ -35,7 +38,8 @@ public: TextureManager(); ~TextureManager(); - Texture* get(const std::string& filename); + TexturePtr get(const std::string& filename); + TexturePtr get(const std::string& filename, const Rect& rect); #ifdef HAVE_OPENGL void register_texture(GLTexture* texture); @@ -47,13 +51,22 @@ public: private: friend class Texture; - void release(Texture* texture); + void reap_cache_entry(const std::string& filename); - typedef std::map ImageTextures; + typedef std::map > ImageTextures; ImageTextures image_textures; - Texture* create_image_texture(const std::string& filename); + TexturePtr create_image_texture(const std::string& filename, const Rect& rect); + /** on failure a dummy texture is returned and no exception is thrown */ + TexturePtr create_image_texture(const std::string& filename); + + /** throw an exception on error */ + TexturePtr create_image_texture_raw(const std::string& filename); + TexturePtr create_image_texture_raw(const std::string& filename, const Rect& rect); + + TexturePtr create_dummy_texture(); + #ifdef HAVE_OPENGL typedef std::set Textures; Textures textures; @@ -77,8 +90,6 @@ private: #endif }; -extern TextureManager* texture_manager; - #endif /* EOF */