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. |
XML:
<ImageComponent> <!-- Properties --> </ImageComponent>
Definition at line 33 of file ImageComponent.h.
ImageComponent::ImageComponent | ( | Entity * | parent | ) |
Constructor (default).
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.
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.
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 | ( | ) |
const SColor & ImageComponent::getAlphaColor | ( | ) | const |
const rect< s32 > & ImageComponent::getClipRect | ( | ) | const |
const SColor & ImageComponent::getColor | ( | ) | const |
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 |
const ITexture * ImageComponent::getTexture | ( | ) | const |
bool ImageComponent::getUseAlphaColor | ( | ) | const |
void ImageComponent::onPause | ( | void * | p | ) |
Pauses the component if the parent is paused.
Definition at line 239 of file ImageComponent.cpp.
void ImageComponent::onRender | ( | void * | p | ) |
Updates the component if the parent is rendered.
Definition at line 229 of file ImageComponent.cpp.
void ImageComponent::onTexture | ( | void * | p | ) |
Responds to changes of the texture attached to this component.
Definition at line 251 of file ImageComponent.cpp.
void ImageComponent::onUnPause | ( | void * | p | ) |
Unpauses the component if the parent is unpaused.
Definition at line 245 of file ImageComponent.cpp.
bool ImageComponent::parseXML | ( | IXMLReader * | file, | |
Entity * | entity | |||
) | [static] |
Parses for a ImageComponent.
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="" />
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="" />
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="" />
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="" />
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="" />
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.
texture | Pointer to the new texture. |
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="" />
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="" />
value | Value to enable or disble this option. |
Definition at line 221 of file ImageComponent.cpp.