SHOW:
|
|
- or go back to the newest paste.
| 1 | //keyboard here is a struct | |
| 2 | /* Lets say it looks like this | |
| 3 | ||
| 4 | typedef struct _keyboard {
| |
| 5 | char keys[256]; | |
| 6 | functionThatReturnsVoid hooks[]; //Array of functions | |
| 7 | functionThatReturnsVoid add_hook(int, func); | |
| 8 | functionThatReturnsVoid keypress(int, char); | |
| 9 | - | } keyboard; |
| 9 | + | } keyboard; */ |
| 10 | keboard *kbdus; | |
| 11 | ||
| 12 | static void kbd_hook(int raw, char layout[256]) {
| |
| 13 | printf("Numerical: %d\n Char:%c", raw, layout[raw]);
| |
| 14 | } | |
| 15 | ||
| 16 | kbdus->keys = KBDLAYOUT; | |
| 17 | kbdus->add_hook(1, kbd_hook); //Hook onto lets say Esc | |
| 18 | kbdus->keypress(1, kbdus->keys); | |
| 19 | ||
| 20 | //Would call the kbd_hook |