Vp event set: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Basic layout |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{sdk method page|event_set|Register an event handler. | |||
|paramex=event_name, event | |||
|parameters= | |||
== | {{sdk parameter row|vp_callback_t |event_name |[[:Category:SDK events|Event]] to set handler for}} | ||
< | {{sdk parameter row|VPEventHandler |event |Event handler}} | ||
|returncodes= | |||
|behavior= | |||
|caveats= | |||
|examples= | |||
<syntaxhighlight lang="c"> | |||
void handle_avatar_add(VPInstance sdk) | |||
{ | { | ||
printf("%s enters.\n", vp_string(sdk, VP_AVATAR_NAME)); | |||
} | } | ||
int main(int argc, const char* argv[]) | |||
{ | |||
//... | |||
vp_event_set(sdk, VP_EVENT_AVATAR_ADD, handle_avatar_add); | |||
//... | |||
} | |||
</syntaxhighlight> | |||
|seealso= | |||
}} |
Latest revision as of 22:03, 13 December 2016
Method call snippet
vp_event_set(instance, event_name, event);
Register an event handler.
Parameters
These are the parameters that this method requires:
Parameter | Usage |
---|---|
VPInstance instance |
Pointer to the instance this method call is intended for |
vp_callback_t event_name |
Event to set handler for |
VPEventHandler event |
Event handler |
Returns
This method returns a return code integer, which indicates whether the call was successful or errored for any reason:
Return code | Cause |
---|---|
VP_RC_SUCCESS |
Successful call (for methods that have a registered callback, it only means the request has been sent) |
Behavior
- There is no special behavior for this method
Examples
void handle_avatar_add(VPInstance sdk)
{
printf("%s enters.\n", vp_string(sdk, VP_AVATAR_NAME));
}
int main(int argc, const char* argv[])
{
//...
vp_event_set(sdk, VP_EVENT_AVATAR_ADD, handle_avatar_add);
//...
}