//set up input
m_script.RegisterObject("TInput");
m_script.RegisterObjectMethod("TInput","bool IsKeyDown(string key)",asMETHOD(TInput,IsKeyDown));
m_script.RegisterAsGlobal("TInput Input",(void*)m_input);
void TScript::RegisterAsGlobal( std::string declaration, void* ptr )
{
if(ptr)
{
int r = m_engine->RegisterGlobalProperty(declaration.c_str(),ptr);
r < 0 ? throw TFatalException("Failed to register global property" + declaration + " with Angel Script. \n\n In:\n TScript::RegisterGloalProperty") : ++r;
}
else
{
throw TFatalException("Failed to register global property " + declaration + " with Angel Script. Reason: Void function pointer. \n\n In:\n TScript::RegisterGloalProperty");
}
}
Input.IsKeyDown("T_Left");
if(Input.IsKeyDown("T_Left") == true)
{
LeftDown();
}
The call into IsKeyDown is made, but it crashes with strange unhandled exception errors when I try working with iterators. If I call the code from my main C++ game loop everything works just peachy! Cheers