Original Post
Hello... I'm working in a singleton class that will handle the angelscript engine (asIScriptEngine), so I can call the script engine (CScript or something like that) and create my own script loading functions (and libraries, like math with functions like sin, cos, tan, rand, etc) simply using: I already have the following code for the class: Obviously, this thing doesn't work, but it is what I'm trying to do. But, how do I "export" all the asIScriptEngine methods to CScript so I can access them via the CScript object? Thanks, Luiz Ribeiro
CScript *se = &CScript::Instance();
se->LoadSectionFile("module", "file.as");
se->RegisterGlobalFunction(.......)
se->BuildModule("module");
class CScript {
public:
CScript &Instance();
// Own functions
int LoadSectionFile(const char *, const char *);
int RegisterMathLib(void);
private:
CScript();
~CScript();
asIScriptEngine *m_pAsEngine;
};
CScript &CScript::Instance() {
static CScript instance;
return instance;
}
CScript::CScript() {
m_pAsEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
}
CScript::~CScript() {
if(m_pAsEngine) {
m_pAsEngine->Release();
m_pAsEngine = NULL;
}
}