Guest User

Untitled

a guest
Feb 11th, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. std::map<string,Texture> AssetManager::textures;
  2.  
  3. sf::Texture AssetManager::manageTextureElement(World& object, string path)
  4. {
  5.     for (auto it = textures.begin(); it != textures.end(); it++)
  6.     {
  7.         if (it->first == path)
  8.         {
  9.             cout << "Copyed" << endl;
  10.             return it->second;
  11.         }
  12.     }
  13.  
  14.     textures.insert(std::pair<string, Texture>(path, Texture()));
  15.     auto it = textures.end();
  16.     it->second.loadFromFile(path);
  17.     textures.end() = it;
  18.     cout << "Added" << endl;
  19.     return it->second;
  20. }
Add Comment
Please, Sign In to add comment