GG: GG::TextureManager Class Reference

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Friends | List of all members
GG::TextureManager Class Reference

`#include <Texture.h>`

## Friends
TextureManager & | GetTextureManager ()

## Mutators
boost::shared_ptr< Texture > | StoreTexture (Texture *texture, const std::string &texture_name)
boost::shared_ptr< Texture > | StoreTexture (const boost::shared_ptr< Texture > &texture, const std::string &texture_name)
boost::shared_ptr< Texture > | GetTexture (const std::string &name, bool mipmap=false)
void | FreeTexture (const std::string &name)

## Detailed Description

A singleton that loads and stores textures for use by GG.

This class is essentially a very thin wrapper around a map of Texture smart pointers, keyed on std::string texture names. The user need only request a texture through GetTexture(); if the texture is not already resident, it will be loaded. If the user would like to create her own images and store them in the manager, that can be accomplished via StoreTexture() calls.

Definition at line 232 of file Texture.h.

## Member Function Documentation

boost::shared_ptr<Texture> GG::TextureManager::StoreTexture | ( | Texture * | texture,
|  | const std::string & | texture_name
| ) |  |

Stores a pre-existing GG::Texture in the manager's texture pool, and returns a shared_ptr to it.

Warning
  Calling code must not delete texture; texture becomes the property of the manager, which will eventually delete it.

boost::shared_ptr<Texture> GG::TextureManager::StoreTexture | ( | const boost::shared_ptr< Texture > & | texture,
|  | const std::string & | texture_name
| ) |  |

Stores a pre-existing GG::Texture in the manager's texture pool, and returns a shared_ptr to it.

Warning
  Calling code must not delete texture; texture becomes the property of the manager, which will eventually delete it.

boost::shared_ptr<Texture> GG::TextureManager::GetTexture | ( | const std::string & | name,
|  | bool | mipmap = `false`
| ) |  |

Returns a shared_ptr to the texture created from image file name. If the texture is not present in the manager's pool, it will be loaded from disk.

void GG::TextureManager::FreeTexture | ( | const std::string & | name | ) |

Removes the manager's shared_ptr to the texture created from image file name, if it exists.

Note
  Due to shared_ptr semantics, the texture may not be deleted until much later.

## Friends And Related Function Documentation

TextureManager& GetTextureManager | ( |  | ) |
| friend

Returns the singleton TextureManager instance.

The documentation for this class was generated from the following file:

- Texture.h