Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

TextureManager Class Reference

The TextureManager class manages a set of numbered textures loaded from a directory with a common extension (specified in the constructor). More...

#include <TextureManager.h>

List of all members.

Public Methods

 TextureManager (std::string directory, std::string extension, GraphicsDevice device)
 Initializes the TextureManager using the textures in the given directory and with the given extension.

 ~TextureManager ()
 Cleans up the textures by releasing all of the textures that were loaded.

int numTextures () const
 Returns the number of textures in this manager, the number that were successfully loaded from manager creation.

Texture getTexture (int idx) const
 Returns the texture for the specified index.


Detailed Description

The TextureManager class manages a set of numbered textures loaded from a directory with a common extension (specified in the constructor).

The files in the directory need to start at number 0 and go to some number. If we call this number "x", and the even extension "ext", the file format should be:

x.ext

TextureManager loads textures in this directory incrementally starting from 0 until it encounters an error loading the next numbered texture (for example if file is not found). It then stops loading and the set of textures consists of all textures successfully loaded.

The end result is that the TextureManager contains n textures numbered from 0 to (n-1), inclusive.


Constructor & Destructor Documentation

TextureManager::TextureManager std::string    directory,
std::string    extension,
GraphicsDevice    device
 

Initializes the TextureManager using the textures in the given directory and with the given extension.

See the class's main documentation for more information on this process. The directory name should NOT contain a trailing slash, and the extension should NOT contain the period.

Call the numTextures method to read how many textures were loaded.

The textures are loaded with the D3DXCreateTextureFromFile function, and thus have the attributes a texture loaded with that function would have.

The textures are loaded onto the given device.

TextureManager is not defaultly constructable -- this is the only valid constructor.

TextureManager::~TextureManager  
 

Cleans up the textures by releasing all of the textures that were loaded.


Member Function Documentation

Texture TextureManager::getTexture int    idx const
 

Returns the texture for the specified index.

Precondition: 0 <= idx < numTextures()

int TextureManager::numTextures  
 

Returns the number of textures in this manager, the number that were successfully loaded from manager creation.


The documentation for this class was generated from the following files:
Generated on Tue Mar 4 02:29:26 2003 for SuperIsoBomb by doxygen1.2.18