Original Post
Hi I've got AngelScript up and working; and am happily passing global variables and functions for the scripts to access. I'm starting SDL from within my script - and have passed in SDL_Init - no problems, it runs. But to setup a screen in SDL, you call a function that returns a 'SDL_Surface'. I have declared this in my C code - SDL_Surface *mainScreen. How do I pass this into my script so it can pass on the pointer from the SDL_CreateSurface function. At the moment I have:
result = scriptEngine->RegisterObjectType("SDL_Surface", sizeof(SDL_Surface), asOBJ_CLASS);
if (result < 0)
{
conPrint(GL_TRUE, "Script: Error: Couldn't register object type");
return false;
}
and then later I pass 'mainScreen' as a global variable. But I get a seg fault when calling 'RegisterObjectType' - how do I go about passing in this structure? Thanks