00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "asImageComponent.h"
00018
00019 #ifdef __COMPILE_WITH_ANGELSCRIPT__
00020
00021 #include "../../ScriptHelper.h"
00022 #include "../../core/asEntityComponent.h"
00023
00024 #include "../../../components/scene/ImageComponent.h"
00025
00026
00028 ImageComponent* createImageComponent(Entity *parent)
00029 {
00030 return new ImageComponent(parent);
00031 }
00032
00034 ImageComponent* createImageComponent(Entity *parent, const std::string &fileName,
00035 const vector2di &position, const rect<s32> &sourceRect,
00036 const rect<s32> &clipRect, const SColor &color,
00037 const SColor &alphaColor, bool useAlphaColor)
00038 {
00039 return new ImageComponent(parent, fileName, position, sourceRect, clipRect, color, alphaColor,
00040 useAlphaColor);
00041 }
00042
00044 void bindImageComponent(asIScriptEngine *engine)
00045 {
00046
00047 int r;
00048
00049
00050 r = engine->RegisterObjectType("ImageComponent", sizeof(ImageComponent), asOBJ_REF); assert(r >= 0);
00051
00052
00053 bindEntityComponentBase<ImageComponent>(engine, "ImageComponent");
00054
00055
00056 r = engine->RegisterObjectBehaviour("EntityComponent", asBEHAVE_REF_CAST, "ImageComponent@ f()",
00057 asFUNCTION((asRefCast<EntityComponent,ImageComponent>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );
00058 r = engine->RegisterObjectBehaviour("ImageComponent", asBEHAVE_IMPLICIT_REF_CAST, "EntityComponent@ f()",
00059 asFUNCTION((asRefCast<ImageComponent,EntityComponent>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );
00060
00061 r = engine->RegisterObjectBehaviour("ImageComponent", asBEHAVE_FACTORY, "ImageComponent@ f(Entity @+)",
00062 asFUNCTIONPR(createImageComponent, (Entity*), ImageComponent*), asCALL_CDECL); assert(r >= 0);
00063 r = engine->RegisterObjectBehaviour("ImageComponent", asBEHAVE_FACTORY, "ImageComponent@ f(Entity @+, " \
00064 "const string &in, const vector2di &in, const recti &in, const recti &in, " \
00065 "const SColor &in, const SColor &in, bool)",
00066 asFUNCTIONPR(createImageComponent, (Entity*, const std::string&,
00067 const vector2di&, const rect<s32>&, const rect<s32>&, const SColor&,
00068 const SColor&, bool), ImageComponent*), asCALL_CDECL); assert(r >= 0);
00069
00070 r = engine->RegisterObjectMethod("ImageComponent", "ImageComponent& opAssign(const ImageComponent &in)",
00071 asFUNCTION(assignT<ImageComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
00072
00073
00074 r = engine->RegisterObjectMethod("ImageComponent", "void setAlphaColor(const SColor &in)",
00075 asMETHOD(ImageComponent, setAlphaColor), asCALL_THISCALL); assert(r >= 0);
00076 r = engine->RegisterObjectMethod("ImageComponent", "void setClipRect(const recti &in)",
00077 asMETHOD(ImageComponent, setClipRect), asCALL_THISCALL); assert(r >= 0);
00078 r = engine->RegisterObjectMethod("ImageComponent", "void setColor(const SColor &in)",
00079 asMETHOD(ImageComponent, setColor), asCALL_THISCALL); assert(r >= 0);
00080 r = engine->RegisterObjectMethod("ImageComponent", "void setPosition(vector2di &in)",
00081 asMETHOD(ImageComponent, setPosition), asCALL_THISCALL); assert(r >= 0);
00082 r = engine->RegisterObjectMethod("ImageComponent", "void setSourceRect(const recti &in)",
00083 asMETHOD(ImageComponent, setSourceRect), asCALL_THISCALL); assert(r >= 0);
00084 r = engine->RegisterObjectMethod("ImageComponent", "void setTexture(const string&in)",
00085 asMETHODPR(ImageComponent, setTexture, (const std::string&), void),
00086 asCALL_THISCALL); assert(r >= 0);
00087 r = engine->RegisterObjectMethod("ImageComponent", "void setUseAlphaColor(bool)",
00088 asMETHOD(ImageComponent, setUseAlphaColor), asCALL_THISCALL); assert(r >= 0);
00089
00090 r = engine->RegisterObjectMethod("ImageComponent", "const SColor& getAlphaColor()",
00091 asMETHOD(ImageComponent, getAlphaColor), asCALL_THISCALL); assert(r >= 0);
00092 r = engine->RegisterObjectMethod("ImageComponent", "const recti& getClipRect()",
00093 asMETHOD(ImageComponent, getClipRect), asCALL_THISCALL); assert(r >= 0);
00094 r = engine->RegisterObjectMethod("ImageComponent", "const SColor& getColor()",
00095 asMETHOD(ImageComponent, getColor), asCALL_THISCALL); assert(r >= 0);
00096 r = engine->RegisterObjectMethod("ImageComponent", "const vector2di& getPosition()",
00097 asMETHOD(ImageComponent, getPosition), asCALL_THISCALL); assert(r >= 0);
00098 r = engine->RegisterObjectMethod("ImageComponent", "const recti& getSourceRect()",
00099 asMETHOD(ImageComponent, getSourceRect), asCALL_THISCALL); assert(r >= 0);
00100 r = engine->RegisterObjectMethod("ImageComponent", "bool getUseAlphaColor()",
00101 asMETHOD(ImageComponent, getUseAlphaColor), asCALL_THISCALL); assert(r >= 0);
00102 }
00103
00104 #endif // __COMPILE_WITH_ANGELSCRIPT__
00105
00106