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 ImageComponent * | refFactory (Entity *parent) |
Will be used to instanciate objects of this class. |
Definition at line 26 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, | |||
rect< s32 > * | clipRect = NULL , |
|||
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 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.
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 | ( | ) |
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 126 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 226 of file ImageComponent.cpp.
void ImageComponent::onRender | ( | void * | p | ) |
Updates the component if the parent is rendered.
Definition at line 216 of file ImageComponent.cpp.
void ImageComponent::onUnPause | ( | void * | p | ) |
Unpauses the component if the parent is unpaused.
Definition at line 232 of file ImageComponent.cpp.
ImageComponent * ImageComponent::refFactory | ( | Entity * | parent | ) | [static] |
Will be used to instanciate objects of this class.
Reimplemented from EntityComponent.
Definition at line 102 of file ImageComponent.cpp.
void ImageComponent::setAlphaColor | ( | const SColor & | color | ) |
Sets the alpha color of the image.
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.
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.
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.
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.
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.
texture | Pointer to the new texture. |
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.
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.
value | Value to enable or disble this option. |
Definition at line 208 of file ImageComponent.cpp.