MCPcopy Create free account
hub / github.com/TankOs/SFGUI / GetImage

Method GetImage

src/SFGUI/ResourceManager.cpp:79–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79std::shared_ptr<const sf::Image> ResourceManager::GetImage( const std::string& path ) {
80 auto image_iter = m_images.find( path );
81
82 if( image_iter != m_images.end() ) {
83 return image_iter->second;
84 }
85
86 // Try to load.
87 auto loader = GetMatchingLoader( path );
88
89 if( !loader ) {
90 return std::shared_ptr<const sf::Image>();
91 }
92
93 auto image = loader->LoadImage( GetFilename( path, *loader ) );
94
95 if( !image ) {
96 return std::shared_ptr<const sf::Image>();
97 }
98
99 // Cache.
100 m_images[path] = image;
101 return image;
102}
103
104std::shared_ptr<const ResourceLoader> ResourceManager::GetMatchingLoader( const std::string& path ) {
105 if( path.empty() || ( path == "Default" ) ) {

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
LoadImageMethod · 0.80

Tested by

no test coverage detected