Texture Class Reference

Class that provides a plane with a masked texture on it. More...

#include <Texture.h>

Inherited by DAEffect, Interface, and Object.

Inheritance diagram for Texture:

Inheritance graph
[legend]
Collaboration diagram for Texture:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Texture ()
 Standard constructor.
virtual ~Texture ()
 Standard destructor.
int loadAndBind (std::string p_filename, eTextureModification p_modifikationflag=TM_Masked_Normal)
 Loads and binds the texture and generates a mask and also binds it.
virtual int render ()
 Renders the plane with the textures on it.
virtual FieldgetField ()
 Returns a pointer to the field class if it is one.
virtual ButtongetButton ()
 Returns a pointer to the button class if it is one.

Static Public Member Functions

static Textureget (int p_id)
 Returns a pointer to the Object identified by its id;.

Public Attributes

int id
 Holds the unique ID, identifying the Object;.
int sequence
 Holds the sequenz number to render.
int sequenceCount
 Holds the number of frames per line.

Protected Attributes

TextureInterfacemyTexture
 Holds the texture to render.
double ratio
 Holds the ratio of the Image.

Static Private Attributes

static std::map< std::string,
TextureInterface * > 
cachedTextures
 Ressource cache - every Texture and Mask has to be loaded only once.
static int idCounter = 1
 Counter for the unique identifier.
static std::map< int, Texture * > allItems
 Map for all Objects ever created.

Detailed Description

Class that provides a plane with a masked texture on it.

Definition at line 35 of file Texture.h.


Constructor & Destructor Documentation

Texture::Texture (  ) 

Standard constructor.

Definition at line 40 of file Texture.cpp.

References allItems, id, and idCounter.

Texture::~Texture (  )  [virtual]

Standard destructor.

Definition at line 46 of file Texture.cpp.

References allItems.


Member Function Documentation

int Texture::loadAndBind ( std::string  p_filename,
eTextureModification  p_modifikationflag = TM_Masked_Normal 
)

Loads and binds the texture and generates a mask and also binds it.

Parameters:
p_filename Filename for the texture to load.
p_modifikationflag Flag for postprocess modifying.
Returns:
0 for success.

Definition at line 60 of file Texture.cpp.

References cachedTextures, myTexture, TextureInterface::ratio, ratio, sequence, and sequenceCount.

Referenced by Unit::load(), Level::load(), Interface::load(), Field::select(), Unit::settle(), and FunctionHandler::standardAction().

int Texture::render (  )  [virtual]

Renders the plane with the textures on it.

Returns:
0 for success.

Reimplemented in Button, DAEffect, and Interface.

Definition at line 78 of file Texture.cpp.

References myTexture, ratio, TextureInterface::render(), sequence, and sequenceCount.

Referenced by Unit::render(), Object::render(), Interface::render(), Field::render(), DAEffect::render(), and Button::render().

Here is the call graph for this function:

Texture * Texture::get ( int  p_id  )  [static]

Returns a pointer to the Object identified by its id;.

Parameters:
p_id id for the object
Returns:
pointer to the object

Definition at line 51 of file Texture.cpp.

References allItems.

Referenced by Interface::render(), FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), FunctionHandler::settle(), FunctionHandler::standardAction(), and FunctionHandler::terminate().

Field * Texture::getField (  )  [virtual]

Returns a pointer to the field class if it is one.

Returns:
Pointer to the Field class, if it is none: null.

Reimplemented in Field.

Definition at line 102 of file Texture.cpp.

Referenced by Interface::render(), FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), FunctionHandler::settle(), FunctionHandler::standardAction(), and FunctionHandler::terminate().

Button * Texture::getButton (  )  [virtual]

Returns a pointer to the button class if it is one.

Returns:
Pointer to the button class, if it is none: null.

Reimplemented in Button.

Definition at line 107 of file Texture.cpp.

Referenced by FunctionHandler::select(), and FunctionHandler::selectBonus().


Member Data Documentation

int Texture::id

Holds the unique ID, identifying the Object;.

Definition at line 89 of file Texture.h.

Referenced by FunctionHandler::select(), FunctionHandler::standardAction(), and Texture().

int Texture::sequence

Holds the sequenz number to render.

Definition at line 94 of file Texture.h.

Referenced by EventAnimation::compute(), loadAndBind(), and render().

int Texture::sequenceCount

Holds the number of frames per line.

It is assumed, that we have a square texture.

Definition at line 99 of file Texture.h.

Referenced by loadAndBind(), render(), and FunctionHandler::standardAction().

TextureInterface* Texture::myTexture [protected]

Holds the texture to render.

Definition at line 105 of file Texture.h.

Referenced by loadAndBind(), and render().

double Texture::ratio [protected]

Holds the ratio of the Image.

Definition at line 110 of file Texture.h.

Referenced by loadAndBind(), render(), and DAEffect::render().

std::map< std::string, TextureInterface * > Texture::cachedTextures [static, private]

Ressource cache - every Texture and Mask has to be loaded only once.

Definition at line 116 of file Texture.h.

Referenced by loadAndBind().

int Texture::idCounter = 1 [static, private]

Counter for the unique identifier.

Definition at line 121 of file Texture.h.

Referenced by Texture().

std::map< int, Texture * > Texture::allItems [static, private]

Map for all Objects ever created.

Definition at line 126 of file Texture.h.

Referenced by get(), Texture(), and ~Texture().


The documentation for this class was generated from the following files:
Generated on Tue Jul 17 22:02:23 2007 for C0re by  doxygen 1.5.2