|
libnds
|
Describes a keyboard. More...
#include <keyboard.h>
Data Fields | |
| bool | altPressed |
| This is true if the ALT key is held. | |
| int | background |
| Background ID used by the keyboard. Initialized by keyboardInit() | |
| bool | ctrlPressed |
| This is true if the CTRL key is held. | |
| u8 | grid_height |
| Grid height, used to translate y coordinate to keymap. | |
| u8 | grid_width |
| Grid width, used to translate x coordinate to keymap. | |
| bool | keyboardOnSub |
| True if the keyboard is on the sub screen. Initialized by keyboardInit(). | |
| u8 | mapBase |
| Map base to be used by the keyboard. Initialized by keyboardInit(). | |
| const KeyMap * | mappings [4] |
| Array of 4 keymap pointers, one for every KeyboardState. | |
| s16 | offset_x |
| Current X offset of the map. Initialized by keyboardInit() | |
| s16 | offset_y |
| Current Y offset of the map. Initialized by keyboardInit() | |
| KeyChangeCallback | OnKeyPressed |
| Will be called on key press. | |
| KeyPutcCallback | OnKeyPutc |
| Called when the keyboard wants to add a character to the FIFO. | |
| KeyChangeCallback | OnKeyReleased |
| Will be called on key release. | |
| KeyUpdateCallback | OnKeyUpdate |
| Called by keyboardUpdate() | |
| const void * | palette |
| Pointer to the palette. | |
| u32 | paletteLen |
| Length in bytes of the palette data. | |
| u8 | scrollSpeed |
| Keyboard scroll speed on hide and show in pixels per frame. | |
| bool | shifted |
| If shifted, true (e.g. if you want the first char to be uppercase). | |
| KeyboardState | state |
| The state of the keyboard. | |
| u8 | tileBase |
| Tile base to be used by keyboard graphics. Initialized by keyboardInit(). | |
| u32 | tileLen |
| Length in bytes of graphics data. | |
| int | tileOffset |
| Tile offset (in bytes) to load graphics. | |
| const void * | tiles |
| Pointer to graphics tiles, cannot exceed 44KB with default base. | |
| bool | visible |
| If visible, true. Initialized by keyboardInit(). | |
Describes a keyboard.
| KeyPutcCallback Keyboard::OnKeyPutc |
Called when the keyboard wants to add a character to the FIFO.
If this is NULL, keyboardFifoPutc() for all keys except for backspace (which calls keyboardFifoUnputc()). If the callback isn't NULL, the callback needs to do it manually.
This is useful if a keypress needs to add multiple characters to the stdin FIFO. For example, libnds usually pushes DVK_UP to the stdin FIFO when the Up key is pressed, but you can make this callback send the '\x1B', '[', 'A' escape sequence instead.
| u8 Keyboard::scrollSpeed |
Keyboard scroll speed on hide and show in pixels per frame.
Must be positive. 0 means that the keyboard is shown/hidden right away.
| int Keyboard::tileOffset |
Tile offset (in bytes) to load graphics.
The map must be preadjusted for this offset. TODO: Make this work.