示例#1
0
TexturePtr
TextureManager::get(const std::string& _filename, const Rect& rect)
{
  std::string filename = FileSystem::normalize(_filename);
  // FIXME: implement caching
  return create_image_texture(filename, rect);
}
ImageTexture*
TextureManager::get(const std::string& _filename)
{
  std::string filename = FileSystem::normalize(_filename);
  ImageTextures::iterator i = image_textures.find(filename);

  ImageTexture* texture = NULL;
  if(i != image_textures.end())
    texture = i->second;

  if(texture == NULL) {
    texture = create_image_texture(filename);
    image_textures[filename] = texture;
  }

  return texture;
}
示例#3
0
TexturePtr
TextureManager::get(const std::string& _filename)
{
  std::string filename = FileSystem::normalize(_filename);
  ImageTextures::iterator i = m_image_textures.find(filename);

  TexturePtr texture;
  if(i != m_image_textures.end())
    texture = i->second.lock();

  if(!texture) {
    texture = create_image_texture(filename);
    texture->cache_filename = filename;
    m_image_textures[filename] = texture;
  }

  return texture;
}