Hi folks!
I was wondering if anyone can provide an explanation on the purpose of the context argument when creating an EventListenerDelegate for an Event Listener. The examples typically use (unsigned long long)this as the value, however that does not work when calling from something like main(). I subbed in the number 0 instead of this and the callback seemed to function correctly. Is there any need to have a valid value for this argument if you don't need a reference to the calling class?
EventListenerDelegate Context
Moderators: Lapo, Bax, MBagnati
Re: EventListenerDelegate Context
The context argument is an optional value.
SmartFox API does not use it; simply propagates it
The argument has been designed to carry an information into the event listener.
This "opaque" argument provides a way (if developer has this need) to move a value into event listener.
The context argument is a number, so the developer can store a numeric value or a pointer to an object instance.
When the developer has not any information to propagate at the event listener, he can set the context argument with a meaningless value: for instance 0.
SmartFox API does not use it; simply propagates it
The argument has been designed to carry an information into the event listener.
This "opaque" argument provides a way (if developer has this need) to move a value into event listener.
The context argument is a number, so the developer can store a numeric value or a pointer to an object instance.
When the developer has not any information to propagate at the event listener, he can set the context argument with a meaningless value: for instance 0.
Who is online
Users browsing this forum: No registered users and 58 guests