Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualAndreas Jonsson

Posted 13 May 2013 - 05:50 PM

For asOBJ_REF you'll use the asBEHAVE_FACTORY instead of asBEHAVE_CONSTRUCT. The copy constructor should thus be registered as a asBEHAVE_FACTORY function that takes as input the reference to the object that should be copied, e.g.

 

engine->RegisterObjectBehaviour("image", asBEHAVE_FACTORY, "image @f(const image &in)", asFUNCTION(ImageCopyFactory), asCALL_CDECL);

 

Did you mean that the engine appeared to enter an infinite loop when you tried to compile a script with img.Copy(@img) and you had registered the function as Copy(const image @&in)? While there is no reason to register the method with this signature (it matches Copy(const image **) in C++), it definitely shouldn't cause a problem. I'll need to look into that, as it would appear to be a bug. That it returned after 7 seconds is probably that the library ran out of memory, as there is no built-in timeout in the library.

 

If you like the speed of AngelScript, you'll need to try it with the JIT compiler from BlindMind once you've gotten everything up an running. You're likely to see a very good boost in performance with that.


#1Andreas Jonsson

Posted 13 May 2013 - 05:01 PM

For asOBJ_REF you'll use the asBEHAVE_FACTORY instead of asBEHAVE_CONSTRUCT. The copy constructor should thus be registered as a asBEHAVE_FACTORY function that takes as input the reference to the object that should be copied, e.g. engine->RegisterObjectBehaviour("image", asBEHAVE_FACTORY, "image @f(const image &in)", asFUNCTION(ImageCopyFactory), asCALL_CDECL);

PARTNERS