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.


- - - - -

registering virtual properties


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 _Engine_   Members   -  Reputation: 193

Like
0Likes
Like

Posted 16 November 2012 - 07:02 AM

Hi!

I can declare global class throught binding with c++ code. Can i bind virtual properties? I don't find any clue in documentation about this feature (((

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3413

Like
0Likes
Like

Posted 16 November 2012 - 07:43 AM

Virtual properties are registered with the engine by registering a pair of get and set functions. For example:

engine->RegisterGlobalFunction("int get_GlobProp()", asFUNCTION(get_GlobProp), asCALL_CDECL);
engine->RegisterGlobalFunction("void set_GlobProp(int)", asFUNCTION(set_GlobProp), asCALL_CDECL);

engine->RegisterObjectMethod("Obj", "int get_ObjProp()", asMETHOD(Obj, get_ObjProp), asCALL_THISCALL);
engine->RegisterObjectMethod("Obj", "void set_ObjProp(int)", asMETHOD(Obj, set_ObjProp), asCALL_THISCALL);

Manual entries describing this:Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 _Engine_   Members   -  Reputation: 193

Like
0Likes
Like

Posted 17 November 2012 - 05:12 AM

Yep, this is working :)

Thank you.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS