Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualOscar1

Posted 13 May 2013 - 10:02 AM

I am trying to do a copy constructor on asOBJ_REF class. Seems the asBEHAVE_CONSTRUCT does not apply to asOBJ_REF classes.

 

Any ideas?

 

I settled so far for 

 

RegisterObjectMethod("image", "void Copy(const image &in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

However my image class asBEHAVE_FACTORY is all object  handles, but I seems not to be able to make the Copy accept the object handles as argument.

 

so I can go 

 

img2.Copy(img); 

and it is fine

 

the 

img2.Copy(@img);

 

would throw compile error.

 

I tried

RegisterObjectMethod("image", "void Copy(const image @&in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

and while it is accepted, the runtime runs into what seems an endless loop (well it does returns after 7 sec which is probably some protection in the angelscript), so I don't think this is how I am supposed to do it.

 

Any help & ideas?

 

BTW, speeds are pretty awesome. I use it for image processing (the looping through the pixels is the main toll) and the scripted version vs native code is about 10-12x slower. So if native version would be 35ms,, the scripted version would be for example 450 ms. I think that is pretty amazing.


#2Oscar1

Posted 13 May 2013 - 07:31 AM

I am trying to do a copy constructor on asOBJ_REF class. Seems the asBEHAVE_CONSTRUCT does not apply to asOBJ_REF classes.

 

Any ideas?

 

I settled so far for 

 

RegisterObjectMethod("image", "void Copy(const image &in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

However my image class asBEHAVE_FACTORY is all object  handles, but I seems not to be able to make the Copy accept the object handles as argument.

 

so I can go 

 

img2.Copy(img); 

and it is fine

 

the 

img2.Copy(@img);

 

would throw compile error.

 

I tried

RegisterObjectMethod("image", "void Copy(const image @&in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

and while it is accepted, the runtime runs into what seems an endless loop (well it does returns after 7 sec which is probably some protection in the angelscript), so I don't think this is how I am supposed to do it.

 

Any help & ideas?


#1Oscar1

Posted 13 May 2013 - 07:27 AM

I am trying to do a copy constructor on asOBJ_REF class. Seems the asBEHAVE_CONSTRUCT does not apply to asOBJ_REF classes.

 

Any ideas?

 

I settled so far for 

 

RegisterObjectMethod("image", "void Copy(const image &in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

However my image class asBEHAVE_FACTORY is all object  handles, but I seems not to be able to make the Copy accept the object handles as argument.

 

so I can go 

 

img2.Copy(img); 

and it is fine

 

the 

img2.Copy(@img);

 

would throw compile error.

 

I tried

RegisterObjectMethod("image", "void Copy(const image @&in)", asMETHOD(CByteImage,Copy), asCALL_THISCALL); assert( r >= 0 );

 

and while it is accepted, the runtime runs into what seems an endless loop (well it does returns after 7 sec), which is weird so I don't think this is how I do it.

 

Any help & ideas?

 

 


PARTNERS