vp_event_set

From Virtual Paradise Wiki
Jump to navigation Jump to search
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);

  //...
}