ImageComponent Class Reference

Component wrapper for drawing 2d images. More...

Inheritance diagram for ImageComponent:

Inheritance graph
[legend]
Collaboration diagram for ImageComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImageComponent (Entity *parent)
 Constructor (default).
 ImageComponent (Entity *parent, const std::string &fileName, const vector2di &position, const rect< s32 > &sourceRect, rect< s32 > *clipRect=NULL, const SColor &color=SColor(255, 255, 255, 255), const SColor &alphaColor=SColor(255, 255, 255, 255), bool useAlphaColor=false)
 Constructor.
 ImageComponent (Entity *parent, ITexture *texture, const vector2di &position, const rect< s32 > &sourceRect, rect< s32 > *clipRect=NULL, const SColor &color=SColor(255, 255, 255, 255), const SColor &alphaColor=SColor(255, 255, 255, 255), bool useAlphaColor=false)
 Constructor.
 ~ImageComponent ()
 Deconstructor.
const SColor & getAlphaColor () const
 Gets the alpha color.
const rect< s32 > * getClipRect () const
 Gets the clipping rectangle.
const SColor & getColor () const
 Gets the color with which the image is drawn.
const vector2di & getPosition () const
 Gets the upper left 2d screen position where the image will be drawn.
const rect< s32 > & getSourceRect () const
 Gets the source rectangle in the image.
const ITexture * getTexture () const
 Gets the texture associated with this component.
bool getUseAlphaColor () const
 Returns whether the alpha color is used.
void setAlphaColor (const SColor &color)
 Sets the alpha color of the image.
void setClipRect (rect< s32 > *rectangle)
 Sets where the image is clipped to.
void setColor (const SColor &color)
 Sets the color with which the image is drawn.
void setPosition (const vector2di &position)
 Sets the upper left 2d screen position where the image will be drawn.
void setSourceRect (const rect< s32 > &rectangle)
 Sets the source rectangle in the image.
void setTexture (const std::string &fileName)
 Loads a texture from the given file and sets it as the texture to be drawn.
void setTexture (ITexture *texture)
 Sets the texture which should be drawn.
void setUseAlphaColor (bool value)
 Sets whether the alpha color should be used.
void onRender (void *p)
 Updates the component if the parent is rendered.
void onPause (void *p)
 Pauses the component if the parent is paused.
void onUnPause (void *p)
 Unpauses the component if the parent is unpaused.

Static Public Member Functions

static ImageComponentrefFactory (Entity *parent)
 Will be used to instanciate objects of this class.


Detailed Description

Component wrapper for drawing 2d images.

Definition at line 26 of file ImageComponent.h.


Constructor & Destructor Documentation

ImageComponent::ImageComponent ( Entity parent  ) 

Constructor (default).

Parameters:
parent The parent entity to which the component should be added.

Definition at line 23 of file ImageComponent.cpp.

ImageComponent::ImageComponent ( Entity parent,
const std::string &  fileName,
const vector2di &  position,
const rect< s32 > &  sourceRect,
rect< s32 > *  clipRect = NULL,
const SColor &  color = SColor(255, 255, 255, 255),
const SColor &  alphaColor = SColor(255, 255, 255, 255),
bool  useAlphaColor = false 
)

Constructor.

Parameters:
parent The parent entity to which the component should be added.
fileName Filename of the texture to load.
position Upper left 2d destination position where the image will be drawn.
sourceRect Source rectangle in the image.
clipRect Pointer to rectangle on the screen where the image is clipped to. If this pointer is NULL the image is not clipped.
color Color with which the image is drawn.
alphaColor Alpha color of the image.
useAlphaColor If true, the alpha channel of the texture is used to draw the image.

Definition at line 44 of file ImageComponent.cpp.

ImageComponent::ImageComponent ( Entity parent,
ITexture *  texture,
const vector2di &  position,
const rect< s32 > &  sourceRect,
rect< s32 > *  clipRect = NULL,
const SColor &  color = SColor(255, 255, 255, 255),
const SColor &  alphaColor = SColor(255, 255, 255, 255),
bool  useAlphaColor = false 
)

Constructor.

Parameters:
parent The parent entity to which the component should be added.
texture Texture to be added to the image component.
position Upper left 2d destination position where the image will be drawn.
sourceRect Source rectangle in the image.
clipRect Pointer to rectangle on the screen where the image is clipped to. If this pointer is NULL the image is not clipped.
color Color with which the image is drawn.
alphaColor Alpha color of the image.
useAlphaColor If true, the alpha channel of the texture is used to draw the image.

Definition at line 70 of file ImageComponent.cpp.

ImageComponent::~ImageComponent (  ) 

Deconstructor.

Definition at line 97 of file ImageComponent.cpp.


Member Function Documentation

const SColor & ImageComponent::getAlphaColor (  )  const

Gets the alpha color.

Definition at line 108 of file ImageComponent.cpp.

const rect< s32 > * ImageComponent::getClipRect (  )  const

Gets the clipping rectangle.

Definition at line 114 of file ImageComponent.cpp.

const SColor & ImageComponent::getColor (  )  const

Gets the color with which the image is drawn.

Definition at line 120 of file ImageComponent.cpp.

const vector2di & ImageComponent::getPosition (  )  const

Gets the upper left 2d screen position where the image will be drawn.

Definition at line 126 of file ImageComponent.cpp.

const rect< s32 > & ImageComponent::getSourceRect (  )  const

Gets the source rectangle in the image.

Definition at line 132 of file ImageComponent.cpp.

const ITexture * ImageComponent::getTexture (  )  const

Gets the texture associated with this component.

Definition at line 138 of file ImageComponent.cpp.

bool ImageComponent::getUseAlphaColor (  )  const

Returns whether the alpha color is used.

Definition at line 144 of file ImageComponent.cpp.

void ImageComponent::onPause ( void *  p  ) 

Pauses the component if the parent is paused.

Note:
For internal use only!

Definition at line 226 of file ImageComponent.cpp.

void ImageComponent::onRender ( void *  p  ) 

Updates the component if the parent is rendered.

Note:
For internal use only!

Definition at line 216 of file ImageComponent.cpp.

void ImageComponent::onUnPause ( void *  p  ) 

Unpauses the component if the parent is unpaused.

Note:
For internal use only!

Definition at line 232 of file ImageComponent.cpp.

ImageComponent * ImageComponent::refFactory ( Entity parent  )  [static]

Will be used to instanciate objects of this class.

Note:
For internal use only!

Reimplemented from EntityComponent.

Definition at line 102 of file ImageComponent.cpp.

void ImageComponent::setAlphaColor ( const SColor &  color  ) 

Sets the alpha color of the image.

Parameters:
color New alpha color of the image.

Definition at line 150 of file ImageComponent.cpp.

void ImageComponent::setClipRect ( rect< s32 > *  rectangle  ) 

Sets where the image is clipped to.

Parameters:
rectangle Pointer to rectangle on the screen where the image is clipped to. If this pointer is NULL the image is not clipped.

Definition at line 159 of file ImageComponent.cpp.

void ImageComponent::setColor ( const SColor &  color  ) 

Sets the color with which the image is drawn.

Parameters:
color New color.

Definition at line 172 of file ImageComponent.cpp.

void ImageComponent::setPosition ( const vector2di &  position  ) 

Sets the upper left 2d screen position where the image will be drawn.

Parameters:
position New position.

Definition at line 178 of file ImageComponent.cpp.

void ImageComponent::setSourceRect ( const rect< s32 > &  rectangle  ) 

Sets the source rectangle in the image.

Parameters:
rectangle New source rectangle from where the image is retrieved.

Definition at line 184 of file ImageComponent.cpp.

void ImageComponent::setTexture ( ITexture *  texture  ) 

Sets the texture which should be drawn.

Parameters:
texture Pointer to the new texture.
Note:
Not available in AngelScript.

Definition at line 199 of file ImageComponent.cpp.

void ImageComponent::setTexture ( const std::string &  fileName  ) 

Loads a texture from the given file and sets it as the texture to be drawn.

Parameters:
fileName Filename of the texture to load.

Definition at line 190 of file ImageComponent.cpp.

void ImageComponent::setUseAlphaColor ( bool  value  ) 

Sets whether the alpha color should be used.

Parameters:
value Value to enable or disble this option.

Definition at line 208 of file ImageComponent.cpp.


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

Generated on Wed Jun 10 22:26:25 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8