Skip to content
tiffany352 edited this page Aug 9, 2012 · 5 revisions

Sypnosis

#include "common/event.h

void il_Event_push(const il_Event_Event* event); void il_Event_pushnew(unsigned id, size_t size, const void * data); const il_Event_Event* il_Event_pop(); void il_Event_handle(il_Event_Event* ev); void il_Event_register(uint16_t eventid, il_Event_Callback callback);

Description

This header provides an interface to the Event Queue for IntenseLogic.

The push and pushnew functions append an event to the end of the queue, push takes an existing event, where pushnew will create one from the given arguments.

The pop function will take a function from the beginning of the queue, remove it, and pass it to the caller.

The handle function will take an event, and run it through all the registered callbacks, before freeing it.

The register function will take an event ID and a callback, and push it into the data structure that holds events to call upon receiving an event of a corresponding ID.

The event structure contains the following fields:

  • uint16_t eventid - Upper half contains the event range, and the lower half contains the individual ID. See Event for details.
  • uint8_t size - Contains the length of the data attribute.
  • uint8_t data[] - A variable-length array containing the data, placed after the event. Used for passing data to events.

Event callbacks are defined as follows: typedef void(*il_Event_Callback)(const il_Event_Event*);

See Also

Clone this wiki locally