| 174 | } |
| 175 | |
| 176 | Texture2D* TextureCache::load(String filename) { |
| 177 | std::string fullPath = SharedContent.getFullPath(filename); |
| 178 | auto it = _textures.find(fullPath); |
| 179 | if (it != _textures.end()) { |
| 180 | return it->second; |
| 181 | } |
| 182 | auto data = SharedContent.load(filename); |
| 183 | if (data.second == 0) { |
| 184 | Error("failed to load texture \"{}\"", filename.toString()); |
| 185 | return nullptr; |
| 186 | } |
| 187 | return update(filename, data.first.get(), data.second); |
| 188 | } |
| 189 | |
| 190 | void TextureCache::loadAsync(String filename, const std::function<void(Texture2D*)>& handler) { |
| 191 | std::string fullPath = SharedContent.getFullPath(filename); |