gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/megaduck/laptop_keyboard/src/megaduck_keyboard.h
1 #include <gbdk/platform.h>
2 #include <stdint.h>
3 #include <stdbool.h>
4
5 #ifndef _MEGADUCK_KEYBOARD_H
6 #define _MEGADUCK_KEYBOARD_H
7
8
9 #define NO_KEY 0u
10
11 // Arrow keys are arbitrarily chosen to not clash with common
12 // ascii chars, though they do match the GBDK ibm_fixed font
13 #define KEY_ARROW_UP 1u
14 #define KEY_ARROW_DOWN 2u
15 #define KEY_ARROW_RIGHT 3u
16 #define KEY_ARROW_LEFT 4u
17 #define KEY_HELP 5u
18 #define KEY_PRINTSCREEN 6u
19
20
21 // Use ascii values for these keys
22 #define KEY_BACKSPACE 8u
23 #define KEY_ENTER 13u
24 #define KEY_ESCAPE 27u
25 #define KEY_DELETE 127u
26
27
28 // Keyboard data
29 typedef struct duck_keyboard_data_t {
30 uint8_t flags;
31 uint8_t scancode;
32 } duck_keyboard_data_t;
33
34
35 // Post-Processed key data
36 extern uint8_t key_pressed;
37 extern uint8_t key_previous;
38
39
40 bool duck_io_poll_keyboard(duck_keyboard_data_t * key_data);
41 char duck_io_process_key_data(duck_keyboard_data_t * key_data, uint8_t megaduck_model);
42
43
44 #endif // _MEGADUCK_KEYBOARD_H
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.