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, const rect< s32 > &clipRect, 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, const rect< s32 > &clipRect, 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 (const 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.
void onTexture (void *p)
 Responds to changes of the texture attached to this component.

Static Public Member Functions

static bool parseXML (IXMLReader *file, Entity *entity)
 Parses for a ImageComponent.


Detailed Description

Component wrapper for drawing 2d images.

XML:

 <ImageComponent>
    <!-- Properties -->
 </ImageComponent>

Definition at line 33 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,
const rect< s32 > &  clipRect,
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 33 of file ImageComponent.cpp.

ImageComponent::ImageComponent ( Entity parent,
ITexture *  texture,
const vector2di &  position,
const rect< s32 > &  sourceRect,
const rect< s32 > &  clipRect,
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 45 of file ImageComponent.cpp.

ImageComponent::~ImageComponent (  ) 

Deconstructor.

Definition at line 58 of file ImageComponent.cpp.


Member Function Documentation

const SColor & ImageComponent::getAlphaColor (  )  const

Gets the alpha color.

Definition at line 77 of file ImageComponent.cpp.

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

Gets the clipping rectangle.

Definition at line 83 of file ImageComponent.cpp.

const SColor & ImageComponent::getColor (  )  const

Gets the color with which the image is drawn.

Definition at line 89 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 95 of file ImageComponent.cpp.

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

Gets the source rectangle in the image.

Definition at line 101 of file ImageComponent.cpp.

const ITexture * ImageComponent::getTexture (  )  const

Gets the texture associated with this component.

Definition at line 107 of file ImageComponent.cpp.

bool ImageComponent::getUseAlphaColor (  )  const

Returns whether the alpha color is used.

Definition at line 113 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 239 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 229 of file ImageComponent.cpp.

void ImageComponent::onTexture ( void *  p  ) 

Responds to changes of the texture attached to this component.

Note:
For internal use only!

Definition at line 251 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 245 of file ImageComponent.cpp.

bool ImageComponent::parseXML ( IXMLReader *  file,
Entity entity 
) [static]

Parses for a ImageComponent.

Note:
For internal use only!

Definition at line 269 of file ImageComponent.cpp.

void ImageComponent::setAlphaColor ( const SColor &  color  ) 

Sets the alpha color of the image.

XML:

     <alphaColor a="" r="" g="" b="" />

Parameters:
color New alpha color of the image.

Definition at line 119 of file ImageComponent.cpp.

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

Sets where the image is clipped to.

XML:

     <clipRect x1="" y1="" x2="" y2="" />

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 128 of file ImageComponent.cpp.

void ImageComponent::setColor ( const SColor &  color  ) 

Sets the color with which the image is drawn.

XML:

     <color a="" r="" g="" b="" />

Parameters:
color New color.

Definition at line 134 of file ImageComponent.cpp.

void ImageComponent::setPosition ( const vector2di &  position  ) 

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

XML:

     <position x="" y="" />

Parameters:
position New position.

Definition at line 140 of file ImageComponent.cpp.

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

Sets the source rectangle in the image.

XML:

     <sourceRect x1="" y1="" x2="" y2="" />

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

Definition at line 146 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 195 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.

XML:

     <texture fileName="" />

Parameters:
fileName Filename of the texture to load.

Definition at line 152 of file ImageComponent.cpp.

void ImageComponent::setUseAlphaColor ( bool  value  ) 

Sets whether the alpha color should be used.

XML:

     <useAlphaColor value="" />

Parameters:
value Value to enable or disble this option.

Definition at line 221 of file ImageComponent.cpp.


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

Generated on Fri Aug 21 23:55:15 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8