InitControlPad

Connects a task to the event broker for control pad interaction.

Synopsis

int32 InitControlPad (int32 nPads)

Description

Initializes global static resources needed for interfacing with the event broker. Uses some high-level convenience functions rather than opting for the low-level method of communicating with the event broker. See other source files for examples of that level of programming.

The function creates an array in which to keep the past states of all the control pads.

Arguments

nPads
Number of control pads to monitor.

Return Value

Returns 0 if successful or a negative error code if an error occurs.

Caveats

This function is neither multi-thread or multi-task capable or safe. You should call this function ONCE AND ONLY ONCE as an initialization routine, before calling DoControlPad(). Doing otherwise could cause undesirable effects.

The main task needs to call KillControlPad() prior to exiting.

Associated Files

controlpad.c, controlpad.h

Location

examples/ExamplesLib

See Also

DoControlPad, KillControlPad