Skip to content
tiffany352 edited this page Jan 1, 2013 · 5 revisions

Types

typedef struct ilE_event {
  uint16_t eventid;
  uint8_t size;
  uint8_t data[];
} ilE_event;

The structure which represents an individual event in the engine. Each of these event objects is pushed as a libevent event into the OS polling mechanism, where the IL event dispatcher goes through and calls all of the callbacks registered for any given ID. This system is due to be dramatically changed before 1.0, so it is best to not rely too heavily on it until then.

typedef void(*ilE_callback)(ilE_event*, void * ctx);

This is the callback type as passed to the register function. It takes the event that is the reason it was invoked, and a user-provided context pointer for implementing closures.

Functions

const ilE_event* ilE_new(uint16_t eventid, uint8_t size, void * data);

Creates a new event using the specified ID, size, and data.

int ilE_push(const ilE_event* event);

Pushes a new event into the queue.

int ilE_pushnew(uint16_t eventid, uint8_t size, void * data);

Combines new and push.

int ilE_timer(const ilE_event* event, struct timeval * interval);

Takes an event that will be called on a timer interval, without ever freeing it. This is how the graphics and logic ticks are registered. Timeval must be a pointer to a timeval struct and must not be freed after it is provided.

int ilE_register(uint16_t eventid, ilE_callback callback, void * ctx);

Registers an event handler for a given ID.

Clone this wiki locally