|
MTek-GDL 0.100.4-muffintrap
|
Data Structures | |
| struct | keyQueryEntry |
| struct | keyQueryStruct |
Enumerations | |
| enum | KeyAction { KeyPressed = 0 , KeyReleased , KeyRepeat } |
| Keyboard action states. More... | |
| enum | KeyCode { KEY_UNKNOWN = 0 , KEY_A , KEY_B , KEY_C , KEY_D , KEY_E , KEY_F , KEY_G , KEY_H , KEY_I , KEY_J , KEY_K , KEY_L , KEY_M , KEY_N , KEY_O , KEY_P , KEY_Q , KEY_R , KEY_S , KEY_T , KEY_U , KEY_V , KEY_W , KEY_X , KEY_Y , KEY_Z , KEY_1 , KEY_2 , KEY_3 , KEY_4 , KEY_5 , KEY_6 , KEY_7 , KEY_8 , KEY_9 , KEY_0 , KEY_ENTER , KEY_ESCAPE , KEY_BACKSPACE , KEY_TAB , KEY_SPACE , KEY_DASH , KEY_EQUAL , KEY_LEFT_BRACKET , KEY_RIGHT_BRACKET , KEY_BACKSLASH , KEY_SEMICOLON , KEY_APOSTROPHE , KEY_GRAVE_ACCENT , KEY_COMMA , KEY_PERIOD , KEY_SLASH , KEY_CAPS_LOCK , KEY_F1 , KEY_F2 , KEY_F3 , KEY_F4 , KEY_F5 , KEY_F6 , KEY_F7 , KEY_F8 , KEY_F9 , KEY_F10 , KEY_F11 , KEY_F12 , KEY_PRINT_SCREEN , KEY_SCROLL_LOCK , KEY_PAUSE , KEY_INSERT , KEY_HOME , KEY_PAGE_UP , KEY_DELETE , KEY_END , KEY_PAGE_DOWN , KEY_RIGHT , KEY_LEFT , KEY_DOWN , KEY_UP , KEY_NUM_LOCK , KEY_KP_DIVIDE , KEY_KP_MULTIPLY , KEY_KP_MINUS , KEY_KP_PLUS , KEY_KP_ENTER , KEY_KP_1 , KEY_KP_2 , KEY_KP_3 , KEY_KP_4 , KEY_KP_5 , KEY_KP_6 , KEY_KP_7 , KEY_KP_8 , KEY_KP_9 , KEY_KP_0 , KEY_KP_DECIMAL , KEY_MENU , KEY_LEFT_CTRL , KEY_LEFT_SHIFT , KEY_LEFT_ALT , KEY_LEFT_WINKEY , KEY_RIGHT_CTRL , KEY_RIGHT_SHIFT , KEY_RIGHT_ALT , KEY_RIGHT_WINKEY , KEY_LAST } |
| Keyboard key codes. | |
| enum | KeyMods { KeyShift = 0x01 , KeyCtrl = 0x02 , KeyAlt = 0x04 } |
| Keyboard modifier bit masks. | |
| enum | KeyLocks { KeyNum = 0x01 , KeyCaps = 0x02 , KeyScroll = 0x04 } |
| Keyboard lock state bit masks. | |
Functions | |
| typedef | void (KeyCallbackFunc(int, int, int, int)) |
| Keyboard event callback. | |
| typedef | void (KeyCharCallbackFunc(int)) |
| Keyboard character press callback. | |
| bool | Init (ConnectCallbackFunc *callback=NULL, const char *keyMap=NULL) |
| Initializes the USB keyboard module. | |
| gdl::ConnectCallbackFunc * | SetConnectCallback (gdl::ConnectCallbackFunc *callback) |
| Sets a keyboard connect callback. | |
| gdl::Keyboard::KeyCallbackFunc * | SetKeyCallback (KeyCallbackFunc *callback) |
| Sets a keyboard event callback. | |
| bool | KeyDown (gdl::Keyboard::KeyCode keyCode) |
| Returns the last reported state of a specified key. | |
| char | GetChar () |
| Returns the last reported character pressed polled by gdl::PrepDisplay() | |
| short | GetLockStates () |
| Returns the status bits of the keyboard's lock states. | |
Keyboard namespace.
Functions, namespaces and typedefs for initializing and reading USB keyboard inputs. The keyboard subsystem features typematic emulation (for key repeating), event callbacks and can pipe key presses to stdin once the subsystem is initialized.
Keyboard action states.
| Enumerator | |
|---|---|
| KeyPressed | Key has been pressed. |
| KeyReleased | Key has been released. |
| KeyRepeat | Key is repeated (when key is held down long enough). |
| short gdl::Keyboard::GetLockStates | ( | ) |
Returns the status bits of the keyboard's lock states.
This function returns the status bits of the 3 lock states on the keyboard which can be tested individually by AND'ing against one of gdl::Keyboard::KeyLocks.
| bool gdl::Keyboard::Init | ( | ConnectCallbackFunc * | callback = NULL, |
| const char * | keyMap = NULL |
||
| ) |
Initializes the USB keyboard module.
This function initializes the USB keyboard subsystem and must be called first before using any of keyboard input functions. Hot-plugging of USB keyboards are supported and a connect/disconnect callback can be set with gdl::Keyboard::SetConnectCallback(). The keyboard will still be detected when plugged through a USB hub but only one keyboard is supported.
| [in] | callback | Pointer to keyboard connect/disconnect callback (see gdl::Keyboard::SetConnectCallback()). |
| [in] | keyMap | Pointer to an array of a custom keyboard map. |
| bool gdl::Keyboard::KeyDown | ( | gdl::Keyboard::KeyCode | keyCode | ) |
Returns the last reported state of a specified key.
This function returns the last state of the specified key whether or not it was pressed down or not.
| [in] | keyCode | The desired gdl::Keyboard::KeyCode to get the last state of (gdl::Keyboard::KEY_UNKNOWN is used for unsupported keys). |
| gdl::ConnectCallbackFunc * gdl::Keyboard::SetConnectCallback | ( | gdl::ConnectCallbackFunc * | callback | ) |
Sets a keyboard connect callback.
This function sets a keyboard connect callback which is called whenever a keyboard is connected or disconnected from one of the console's USB ports.
Define your callback function as follows:
connect will be true when a keyboard was connected, otherwise it was disconnected.
| [in] | *callback | The new keyboard connect callback or NULL to remove the callback. |
| gdl::Keyboard::KeyCallbackFunc * gdl::Keyboard::SetKeyCallback | ( | KeyCallbackFunc * | callback | ) |
Sets a keyboard event callback.
This function sets a callback for key press events which is called whenever a key is pressed, repeated or released.
Define your callback function as follows:
keyCode is one of gdl::Keyboard::KeyCode of the key that was pressed, repeated or released and is relative to the currently set keymap, scanCode is the raw keyboard code and is not dependent to the loaded keymap (see here at page 53 for reference), action is one of gdl::Keyboard::KeyAction states, mods are the modifier keys that were held down when a key is pressed which can be masked with one of gdl::Keyboard::KeyMods;
| [in] | *callback | Pointer to keyboard event callback function. |