Aw instance event set

From ActiveWiki
Jump to navigation Jump to search



Minimum requirements
Added in version 4.1


int aw_instance_event_set (AW_EVENT_ATTRIBUTE e, void (*handler) (void))

Description

Subscribes the current instance to an event and installs a handler function.

Callback

None (returns immediately)

Notes

Once an instance has subscribed to an event, it will begin receiving notifications as that event occurs. Notifications occur in the form of calls to the event handler function that was supplied.

To unsubscribe from a particular event, call this method with handler set to NULL.

For more information on events and event handlers, see Events.

Arguments

e
Event (defined in Aw.h)
handler
Handler.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_INVALID_INSTANCE
RC_INVALID_ATTRIBUTE
Not an event.

Returned attributes

None

Usage

void avatar_add (void)
{
  printf ("%s has entered the scene\n", aw_string (AW_AVATAR_NAME));
}

aw_instance_event_set (AW_EVENT_AVATAR_ADD, avatar_add);

See also