Métodos públicos estáticos | |
| static bool | StartUp () |
| static void | Shutdown () |
| static int | RegisterGlobalProperty (char *szDecl, void *var) |
| static int | RegisterGlobalFunction (char *szDecl, asUPtr funcPointer, asDWORD callConv) |
| static int | RegisterObjectType (const char *szClassName, int iSize, asDWORD flags) |
| static int | RegisterObjectProperty (const char *szClassName, const char *szPropertyDecl, int byteOffset) |
| static int | RegisterObjectMethod (const char *szClassName, const char *szDecl, asUPtr funcPointer, asDWORD callConv) |
| static int | RegisterObjectBehaviour (const char *szClassName, asDWORD behaviour, const char *szDeclaration, asUPtr funcPointer, asDWORD callConv) |
| static Script * | AddScript (char *szModule, char *szSection) |
| static bool | RemoveScript (Script *script) |
| static bool | ClearScriptList () |
| static bool | CompileModule (char *szModule) |
| static bool | ExecuteString (char *szModule, char *script) |
| static bool | LoadByteCode (char *szModule, char *szFilename) |
| static bool | SaveByteCode (char *szModule, char *szFilename) |
| static asIScriptEngine * | GetEngine () |
Amigas | |
| class | Script |
// Codigo C++ bool TestGame::OnInit() { int ap = 10; if (!ScriptMgr::StartUp()) return false; // Registro la variable ap en el sistema de script int result = ScriptMgr::RegisterGlobalProperty("int ap",&ap); // Pido un nuevo script en el módulo ZakEngine y la sección namespace _script = ScriptMgr::AddScript("ZakEngine", "namespace"); // Cargo el script _script->LoadScript("data/scripts/script.as"); // Compilo el módulo if (!ScriptMgr::CompileModule("ZakEngine")) return false; // Pido el id de la función _func = _script->GetFunctionIdByDecl("void DoSomething(int x)"); // Preparo la función _script->Prepare(_func); // Paso al argumento 0 (el primero de tipo DWord) el valor 5 _script->SetArgDWord(0,5); // Ejecuto el script _script->Execute(); } bool TestGame::OnShutdown() { // Elimino la lista de scripts ScriptMgr::ClearScriptList(); return true; }
// Codigo en AngelScript void DoSomething(int x) { ap = x; }
| bool zak::ScriptMgr::StartUp | ( | ) | [static] |
Inicializa el motor de scripting
| void zak::ScriptMgr::Shutdown | ( | ) | [static] |
Apaga el motor de scripting
| static int zak::ScriptMgr::RegisterGlobalProperty | ( | char * | szDecl, | |
| void * | var | |||
| ) | [inline, static] |
Registra una propiedad global
| szDecl | declaración de la propiedad global | |
| var | puntero a la variable que se desea registrar |
| static int zak::ScriptMgr::RegisterGlobalFunction | ( | char * | szDecl, | |
| asUPtr | funcPointer, | |||
| asDWORD | callConv | |||
| ) | [inline, static] |
Registra una función global
| szDecl | declaración de la función global | |
| funcPointer | puntero a la función que se desea registrar | |
| callConv | convención de invocación (recomiendo leer la documentación de AngelScript para mayor información) |
| static int zak::ScriptMgr::RegisterObjectType | ( | const char * | szClassName, | |
| int | iSize, | |||
| asDWORD | flags | |||
| ) | [inline, static] |
Registra un tipo de objeto para poder ser utilizado en el script
| szClassName | nombre de la clase como debe ser utilizado en el script | |
| iSize | tamaño en memoria (en bytes) del objeto | |
| flags | debe ser uno de los valores soportados por el motor de script (leer documentación de AngelScript) |
| static int zak::ScriptMgr::RegisterObjectProperty | ( | const char * | szClassName, | |
| const char * | szPropertyDecl, | |||
| int | byteOffset | |||
| ) | [inline, static] |
Registra un propiedad de un objeto ya registrado en el script para que pueda ser accedido desde el mismo
| szClassName | nombre de la clase como debe ser utilizada en el script | |
| szPropertyDecl | declaración de la propiedad | |
| byteOffset | el offset desde el puntero del objeto donde se aloja la propiedad (para más información referirse a la documentación de AngelScript) |
| static int zak::ScriptMgr::RegisterObjectMethod | ( | const char * | szClassName, | |
| const char * | szDecl, | |||
| asUPtr | funcPointer, | |||
| asDWORD | callConv | |||
| ) | [inline, static] |
Registra un método de un objeto ya registrado en el script para que pueda ser accedido desde el mismo
| szClassName | nombre de la clase como debe ser utilizada en el script | |
| szDecl | declaración del método | |
| funcPointer | puntero al método | |
| callConv | convención de invocación del método (referirse a la documentación de AngelScript) |
| static int zak::ScriptMgr::RegisterObjectBehaviour | ( | const char * | szClassName, | |
| asDWORD | behaviour, | |||
| const char * | szDeclaration, | |||
| asUPtr | funcPointer, | |||
| asDWORD | callConv | |||
| ) | [inline, static] |
Registra el compotamiento de un objeto (invocación de constructor, destructor, operadores, etc).
| szClassName | nombre de la clase como debe ser utilizada en el script | |
| behaviour | flags de comportamiento (referirse a la documentación de AngelScript) | |
| szDeclaration | declaración de la función a invocar | |
| funcPointer | puntero a la función | |
| callConv | convención de invocación del método (referirse a la documentación de AngelScript) |
| Script * zak::ScriptMgr::AddScript | ( | char * | szModule, | |
| char * | szSection | |||
| ) | [static] |
Agrega un nuevo script al motor
| szModule | nombre del módulo al que pertenece | |
| szSection | sección dentro del módulo (parecido a un namespace) |
| bool zak::ScriptMgr::RemoveScript | ( | Script * | script | ) | [static] |
Remueve un script del motor
| script | puntero al script a remover |
| bool zak::ScriptMgr::ClearScriptList | ( | ) | [static] |
Elimina la lista de scripts
| bool zak::ScriptMgr::CompileModule | ( | char * | szModule | ) | [static] |
Compila el módulo pasado por parámetro
| szModule | nombre del módulo a compilar |
| static bool zak::ScriptMgr::ExecuteString | ( | char * | szModule, | |
| char * | script | |||
| ) | [inline, static] |
Ejecuta una sentencia pasada en una cadena de caracteres en un módulo determinado
| szModule | nombre del módulo en el cual ejecutar la sentencia | |
| script | la sentencia a ejecutar |
1.5.1-p1