de.rico.engine.resource
Class TextureManager

java.lang.Object
  extended by de.rico.engine.resource.TextureManager

public class TextureManager
extends java.lang.Object

This class can be used as a container that manages the different texture used in the game. It implements the singleton pattern.

Author:
Frank Bruns

Method Summary
 void add(java.lang.String name, com.sun.opengl.util.texture.Texture tex)
          Adds a texture to the texture manager.
 void clear()
          Clears the textures from the texture manager
 com.sun.opengl.util.texture.Texture get(java.lang.String name)
          Returns the texture that is referenced by the specified name.
static TextureManager getInstance()
          Returns the singleton instance of the texture manager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TextureManager getInstance()
Returns the singleton instance of the texture manager.

Returns:
singleton instance of the texture manage

add

public void add(java.lang.String name,
                com.sun.opengl.util.texture.Texture tex)
Adds a texture to the texture manager. The texture can later be referenced by the specified name.
Note: To avoid problems, the name for the texture must be unique!

Parameters:
tex - texture to add to the texture manager

get

public com.sun.opengl.util.texture.Texture get(java.lang.String name)
Returns the texture that is referenced by the specified name.

Parameters:
name - reference name for the texture to be retrieved
Returns:
texture that is referenced by the specified name

clear

public void clear()
Clears the textures from the texture manager