00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "asEntity.h"
00018
00019 #ifdef __COMPILE_WITH_ANGELSCRIPT__
00020
00021 #include "../ScriptHelper.h"
00022
00023 #include "../../core/Entity.h"
00024
00025
00027 Entity* createEntity(const std::string &name)
00028 {
00029 return new Entity(name);
00030 }
00031
00033 void bindEntity(asIScriptEngine *engine)
00034 {
00035
00036 int r;
00037
00038
00039 r = engine->RegisterObjectType("Entity", sizeof(Entity), asOBJ_REF);
00040 r = engine->RegisterObjectType("EntityComponent", sizeof(EntityComponent), asOBJ_REF);
00041
00042
00043 r = engine->RegisterObjectBehaviour("Entity", asBEHAVE_FACTORY, "Entity@ f(const string &in)",
00044 asFUNCTION(createEntity), asCALL_CDECL); assert(r >= 0);
00045 r = engine->RegisterObjectBehaviour("Entity", asBEHAVE_ADDREF, "void f()",
00046 asMETHOD(Entity, grab), asCALL_THISCALL); assert(r >= 0);
00047 r = engine->RegisterObjectBehaviour("Entity", asBEHAVE_RELEASE, "void f()",
00048 asMETHOD(Entity, drop), asCALL_THISCALL); assert(r >= 0);
00049
00050 r = engine->RegisterObjectMethod("Entity", "Entity& opAssign(const Entity &in)",
00051 asFUNCTION(assignT<Entity>), asCALL_CDECL_OBJLAST); assert(r >= 0);
00052
00053
00054 r = engine->RegisterObjectMethod("Entity", "u32 getID()",
00055 asMETHOD(Entity, getID), asCALL_THISCALL); assert(r >= 0);
00056 r = engine->RegisterObjectMethod("Entity", "const string& getName()",
00057 asMETHOD(Entity, getName), asCALL_THISCALL); assert(r >= 0);
00058
00059 r = engine->RegisterObjectMethod("Entity", "bool addChild(Entity @+)",
00060 asMETHOD(Entity, addChild), asCALL_THISCALL); assert(r >= 0);
00061 r = engine->RegisterObjectMethod("Entity", "bool addComponent(EntityComponent @+)",
00062 asMETHOD(Entity, addComponent), asCALL_THISCALL); assert(r >= 0);
00063
00064 r = engine->RegisterObjectMethod("Entity", "Entity@ getChild(const u32)",
00065 asMETHODPR(Entity, getChild, (const u32), Entity*),
00066 asCALL_THISCALL); assert(r >= 0);
00067 r = engine->RegisterObjectMethod("Entity", "Entity@ getChild(const string &in)",
00068 asMETHODPR(Entity, getChild, (const std::string &), Entity*),
00069 asCALL_THISCALL); assert(r >= 0);
00070 r = engine->RegisterObjectMethod("Entity", "EntityComponent@ getComponent(const u32)",
00071 asMETHODPR(Entity, getComponent, (const u32), EntityComponent*),
00072 asCALL_THISCALL); assert(r >= 0);
00073 r = engine->RegisterObjectMethod("Entity", "EntityComponent@ getComponent(const string &in)",
00074 asMETHODPR(Entity, getComponent, (const std::string &), EntityComponent*),
00075 asCALL_THISCALL); assert(r >= 0);
00076
00077 r = engine->RegisterObjectMethod("Entity", "Entity@ getParent()",
00078 asMETHOD(Entity, getParent), asCALL_THISCALL); assert(r >= 0);
00079
00080 r = engine->RegisterObjectMethod("Entity", "bool loadXML(const string &in)",
00081 asMETHODPR(Entity, loadXML, (const std::string&), bool), asCALL_THISCALL);
00082 assert(r >= 0);
00083
00084 r = engine->RegisterObjectMethod("Entity", "void removeChildren()",
00085 asMETHOD(Entity, removeChildren), asCALL_THISCALL); assert(r >= 0);
00086 r = engine->RegisterObjectMethod("Entity", "void removeComponents()",
00087 asMETHOD(Entity, removeComponents), asCALL_THISCALL); assert(r >= 0);
00088 r = engine->RegisterObjectMethod("Entity", "bool removeChild(Entity @+)",
00089 asMETHODPR(Entity, removeChild, (Entity*), bool),
00090 asCALL_THISCALL); assert(r >= 0);
00091 r = engine->RegisterObjectMethod("Entity", "bool removeChild(const u32)",
00092 asMETHODPR(Entity, removeChild, (const u32), bool),
00093 asCALL_THISCALL); assert(r >= 0);
00094 r = engine->RegisterObjectMethod("Entity", "bool removeChild(const string &in)",
00095 asMETHODPR(Entity, removeChild, (const std::string&), bool),
00096 asCALL_THISCALL); assert(r >= 0);
00097 r = engine->RegisterObjectMethod("Entity", "bool removeComponent(EntityComponent @+)",
00098 asMETHODPR(Entity, removeComponent, (EntityComponent*), bool),
00099 asCALL_THISCALL); assert(r >= 0);
00100 r = engine->RegisterObjectMethod("Entity", "bool removeComponent(const u32)",
00101 asMETHODPR(Entity, removeComponent, (const u32), bool),
00102 asCALL_THISCALL); assert(r >= 0);
00103 r = engine->RegisterObjectMethod("Entity", "bool removeComponent(const string &in)",
00104 asMETHODPR(Entity, removeComponent, (const std::string&), bool),
00105 asCALL_THISCALL); assert(r >= 0);
00106 r = engine->RegisterObjectMethod("Entity", "void removeParent()",
00107 asMETHOD(Entity, removeParent), asCALL_THISCALL); assert(r >= 0);
00108
00109 r = engine->RegisterObjectMethod("Entity", "void setParent(Entity @+)",
00110 asMETHOD(Entity, setParent), asCALL_THISCALL); assert(r >= 0);
00111
00112 r = engine->RegisterObjectMethod("Entity", "void setAbsolutePosition(vector3df &in)",
00113 asMETHOD(Entity, setAbsolutePosition), asCALL_THISCALL); assert(r >= 0);
00114 r = engine->RegisterObjectMethod("Entity", "void setPosition(vector3df &in)",
00115 asMETHOD(Entity, setPosition), asCALL_THISCALL); assert(r >= 0);
00116 r = engine->RegisterObjectMethod("Entity", "void setAbsoluteRotation(vector3df &in)",
00117 asMETHOD(Entity, setAbsoluteRotation), asCALL_THISCALL); assert(r >= 0);
00118 r = engine->RegisterObjectMethod("Entity", "void setRotation(vector3df &in)",
00119 asMETHOD(Entity, setRotation), asCALL_THISCALL); assert(r >= 0);
00120 }
00121
00122 #endif // __COMPILE_WITH_ANGELSCRIPT__
00123
00124