KBDSetKeyCallback

Syntax

#include <cafe/kbd.h>

KBDKeyCallbackF KBDSetKeyCallback (KBDKeyCallbackF fn);

Parameters

fn Pointer to a function to callback when a key is pressed or released on the keyboard.

Return Values

KBDKeyCallbackF A pointer to the previous keyboard key callback.

Description

This call registers a function that the KBD library will call whenever a keyboard key is pressed or released. The function pointer typedef KBDKeyCallbackF is defined as shown below.

typedef void (*KBDKeyCallbackF) (KBDKeyEvent*);

To call the fn function, use a pointer to the KBDKeyEvent structure. The KBDKeyEvent structure contains the keyboard channel that generated the event, the USB HID code associated with the key, the type of key event, the current keyboard modifier state, and the translated Unicode associated with the key.

For more information about the data within this structure, refer to KBDKeyEvent.

Do Not Call From

Background Do not call this function from the background.
Multiple threads This function is not thread-safe.

See Also

KBDKeyEvent

Revision History

2013-05-08 Automated cleanup pass.
2011-12-21 Moved to Cafe.
2007-03-19 Initial version.


CONFIDENTIAL