00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __IMAGECOMPONENT_H__
00017 #define __IMAGECOMPONENT_H__
00018
00019
00020 #include "../../dependencies.h"
00021 #include "../../core/EntityComponent.h"
00022
00023
00024
00026 class ImageComponent : public EntityComponent
00027 {
00028 public:
00029
00030
00033 ImageComponent(Entity *parent);
00044 ImageComponent(Entity *parent, const std::string &fileName, const vector2di &position,
00045 const rect<s32> &sourceRect, rect<s32> *clipRect = NULL,
00046 const SColor &color = SColor(255, 255, 255, 255),
00047 const SColor &alphaColor = SColor(255, 255, 255, 255),
00048 bool useAlphaColor = false);
00059 ImageComponent(Entity *parent, ITexture *texture, const vector2di &position,
00060 const rect<s32> &sourceRect, rect<s32> *clipRect = NULL,
00061 const SColor &color = SColor(255, 255, 255, 255),
00062 const SColor &alphaColor = SColor(255, 255, 255, 255),
00063 bool useAlphaColor = false);
00065 ~ImageComponent();
00066
00067
00070 static ImageComponent* refFactory(Entity *parent);
00071
00072
00074 const SColor& getAlphaColor() const;
00076 const rect<s32>* getClipRect() const;
00078 const SColor& getColor() const;
00080 const vector2di& getPosition() const;
00082 const rect<s32>& getSourceRect() const;
00084 const ITexture* getTexture() const;
00086 bool getUseAlphaColor() const;
00087
00090 void setAlphaColor(const SColor &color);
00094 void setClipRect(rect<s32> *rectangle);
00097 void setColor(const SColor &color);
00100 void setPosition(const vector2di &position);
00103 void setSourceRect(const rect<s32> &rectangle);
00106 void setTexture(const std::string &fileName);
00110 void setTexture(ITexture *texture);
00113 void setUseAlphaColor(bool value);
00114
00115
00118 void onRender(void *p);
00121 void onPause(void *p);
00124 void onUnPause(void *p);
00125
00126 private:
00127
00128
00129 ITexture *mTexture;
00130
00131 SColor mAlphaColor;
00132 rect<s32> *mClipRect;
00133 SColor mColor;
00134 vector2di mPosition;
00135 rect<s32> mSourceRect;
00136
00137 bool mVisible;
00138 bool mUseAlphaColor;
00139 bool mWasVisible;
00140
00141 };
00142
00143
00144
00146 extern void bindImageComponent(asIScriptEngine *engine);
00147
00148 #endif