TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
TextureManager.hpp
1 //
3 // TGUI - Texus's Graphical User Interface
4 // Copyright (C) 2012 Bruno Van de Velde (VDV_B@hotmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 
26 #ifndef _TGUI_TEXTURE_MANAGER_INCLUDED_
27 #define _TGUI_TEXTURE_MANAGER_INCLUDED_
28 
30 
31 #include <list>
32 
34 
35 namespace tgui
36 {
38 
39  struct TGUI_API TextureManager : public sf::NonCopyable
40  {
52  virtual bool getTexture(const std::string& filename, sf::Texture*& textureToLoad);
53 
54 
66  virtual bool copyTexture(sf::Texture* const textureToCopy, sf::Texture*& newTexture);
67 
68 
76  virtual void removeTexture(sf::Texture*& textureToRemove);
77 
78 
84  virtual bool isTransparentPixel(const sf::Texture* const texture, unsigned int x, unsigned int y);
85 
86 
88  protected:
89 
90  std::vector<std::string> m_Filenames; // The filenames of the texture
91  std::vector<sf::Image> m_Images; // The SFML images
92  std::list<sf::Texture> m_Textures; // The SFML textures
93  std::vector<unsigned int> m_Users; // The number of times this texture is used
94  };
95 
97 }
98 
100 
101 #endif //_TGUI_TEXTURE_MANAGER_INCLUDED_
Definition: TextureManager.hpp:39