00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "asScript.h"
00018
00019 #ifdef __COMPILE_WITH_ANGELSCRIPT__
00020
00021 #include "../ScriptHelper.h"
00022
00023 #include "../Script.h"
00024
00025
00027 Script* createScript(const std::string &name)
00028 {
00029 return new Script(name);
00030 }
00031
00033 void bindScript(asIScriptEngine *engine)
00034 {
00035
00036 int r;
00037
00038
00039 r = engine->RegisterObjectType("Script", sizeof(Script), asOBJ_REF); assert(r >= 0);
00040
00041
00042 r = engine->RegisterObjectBehaviour("Script", asBEHAVE_FACTORY, "Script@ f(const string &in)",
00043 asFUNCTION(createScript), asCALL_CDECL); assert(r >= 0);
00044 r = engine->RegisterObjectBehaviour("Script", asBEHAVE_ADDREF, "void f()",
00045 asMETHOD(Script, grab), asCALL_THISCALL); assert(r >= 0);
00046 r = engine->RegisterObjectBehaviour("Script", asBEHAVE_RELEASE, "void f()",
00047 asMETHOD(Script, drop), asCALL_THISCALL); assert(r >= 0);
00048
00049
00050 r = engine->RegisterObjectMethod("Script", "u32 getID()",
00051 asMETHOD(Script, getID), asCALL_THISCALL); (r >= 0);
00052 r = engine->RegisterObjectMethod("Script", "const string& getName()",
00053 asMETHOD(Script, getName), asCALL_THISCALL); assert(r >= 0);
00054
00055 r = engine->RegisterObjectMethod("Script", "bool loadScript(const string &in)",
00056 asMETHODPR(Script, loadScript, (const std::string&), bool),
00057 asCALL_THISCALL);assert(r >= 0);
00058 r = engine->RegisterObjectMethod("Script", "bool unloadScript()",
00059 asMETHOD(Script, unloadScript), asCALL_THISCALL);assert(r >= 0);
00060
00061 r = engine->RegisterObjectMethod("Script", "bool executeFunctionByName(const string &in, const string &in)",
00062 asMETHOD(Script, executeFunctionByName), asCALL_THISCALL);assert(r >= 0);
00063 }
00064
00065 #endif // __COMPILE_WITH_ANGELSCRIPT__
00066
00067