GG::TextureManager Class Reference

This singleton class is essentially a very thin wrapper around a map of Texture smart pointers, keyed on std::string texture names. More...

#include <Texture.h>

List of all members.

Mutators

boost::shared_ptr< TextureStoreTexture (Texture *texture, const std::string &texture_name)
boost::shared_ptr< TextureStoreTexture (const boost::shared_ptr< Texture > &texture, const std::string &texture_name)
boost::shared_ptr< TextureGetTexture (const std::string &name, bool mipmap=false)
void FreeTexture (const std::string &name)

Static Public Member Functions

static void InitDevIL ()

Friends

TextureManagerGetTextureManager ()


Detailed Description

This singleton 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 205 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.

static void GG::TextureManager::InitDevIL (  )  [static]

initializes DevIL image library, if it is not already initialized


Friends And Related Function Documentation

TextureManager& GetTextureManager (  )  [friend]

Returns the singleton TextureManager instance.


The documentation for this class was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2