Hello,
I'm new to AngelScript and I'm quite lost with it to speak the truth.
Anyways my proplem is that in my script this works:
int x = 0;
int y = 0;
void onClick()
{
//if(handle is null)
IWindow@ handle = addWindow("Equip.backgrnd",x,y,x,y,"");
//else
// handle.close();
}
But this does not:
int x = 0;
int y = 0;
IWindow@ handle;
void onClick()
{
if(handle is null)
handle = addWindow("Equip.backgrnd",x,y,x,y,"");
//else
// handle.close();
}
It opens the window correctly in second code, but i get error about NULL pointer expection.
I register my methods and objects like this:
r = engine->RegisterObjectType("IWindow", sizeof(iWindow*), asOBJ_REF); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("IWindow", asBEHAVE_ADDREF, "void f()", asMETHOD(iWindow, add),asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("IWindow", asBEHAVE_RELEASE, "void f()", asMETHOD(iWindow, release),asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("IWindow", asBEHAVE_ASSIGNMENT, "IWindow &f(IWindow &in)", asMETHODPR(iWindow, operator=, (const iWindow&), iWindow&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterGlobalFunction("IWindow@ addWindow(const string &in, uint32, uint32, uint32, uint32, const string &in)", asFUNCTION(addWindow), asCALL_CDECL); assert( r >= 0 );
Hope you understood. I would really like to use AngelScript in my Client, because of the syntax. But it lacks lots of examples about different things so it's quite hard to get started with it IMO.