#include <revolution/kbd.h> KBDKeyCallbackF KBDSetKeyCallback (KBDKeyCallbackF fn);
| fn | Pointer to a function to callback when a key is pressed or released on the keyboard. |
|---|
| KBDKeyCallbackF | A pointer to the previous keyboard key callback. |
|---|
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 struct _KBDKeyEvent {
KBDChannel channel;
KBDHIDCode hid; // USB HID code
KBDKeyMode mode; // for up/down/etc
KBDModState modState; // modifier state
KBDUnicode unicode; // Unicode, if any
} KBDKeyEvent;
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 detail about the data within this structure, refer to KBDKeyEvent.
Keyboard Functions, KBDKeyEvent
2007/03/19 Initial version.
CONFIDENTIAL