#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 for the KBD library to call whenever a keyboard key is pressed or released. The function pointer typedef KBDKeyCallbackF is defined as follows.
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*);
The fn function is called by a pointer to the KBDKeyEvent structure. The KBDKeyEvent structure includes the keyboard channel that generated the event, USB HID code for a given key, key event type, current state of the keyboard modifier keys, and converted Unicode for a given key.
For more details about the data within this structure, refer to KBDKeyEvent.
Keyboard Functions, KBDKeyEvent
2007/03/19 Initial version.