Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef TEXTURE_MANAGER_HPP
- #define TEXTURE_MANAGER_HPP
- #include <SFML/Graphics.hpp>
- #include <string>
- #include <map>
- class TextureManager {
- private:
- static TextureManager* p_instance;
- TextureManager() { }
- TextureManager( const TextureManager& );
- TextureManager& operator=( TextureManager& );
- public:
- static TextureManager* get() {
- if(!p_instance)
- p_instance = new TextureManager();
- return p_instance;
- }
- /* Add a texture from a file */
- void loadTexture(const std::string& name, const std::string &filename);
- /* Translate and id into reference */
- sf::Texture& getRef(const std::string& texture);
- private:
- /* Array of textures */
- std::map<std::string, sf::Texture> textures;
- };
- #endif // TEXTURE_MANAGER_HPP
Advertisement
Add Comment
Please, Sign In to add comment