# Sample Programs

This section describes five sample programs for the mouse peripheral provided with the Portfolio operating system software.

Sample programs are included in the operating system software (in the 3DO:examples:Eventbroker folder) and are installed automatically with the operating system. Updates are provided on the 3DO InfoServer bulletin board (415.261.3405). Contact the Developer Technical Support staff on the InfoLine (415.261.3400) for additional information.

`cpdump.c`

Sends the event broker several requests for information and interprets the replies. Asks for (and prints) a list of control port devices currently hooked up to the bus, as well as a list of listeners.

`focus.c`

Asks the event broker to tell it which listener has the "focus of attention," or instructs the event broker to take the focus of attention away from one listener and assign it to another.

`lookie.c`

Uses the direct (low-level) interface to the event broker. Asks the event broker to send it a large class of events, including most of the control pad events, most of the mouse events, as well as several miscellaneous events; for example, change of the control port configuration and loss of events. Whenever `lookie` receives an event message from the event broker, it scans the message and prints the contents of each event frame.

`luckie.c`

Uses the event broker's "convenience interface" to watch for and print the button settings of the first control pad whenever they change. The code registers with the convenience interface, then calls `GetControlPad` ("go to sleep until the settings for control pad #1 change, then return the settings to me"). Whenever the call to `GetControlPad` returns, `luckie` prints the settings and calls `GetControlPad` again.

`maus.c`

Similar to `luckie,` but monitors first mouse. Prints current mouse position each time the event broker reports it has changed.