parser lib for my games
| 1 | #ifndef PARSER_H |
| 2 | #define PARSER_H |
| 3 | |
| 4 | #include <string.h> |
| 5 | #include <ctype.h> |
| 6 | #include <stdint.h> |
| 7 | #include <stdbool.h> |
| 8 | |
| 9 | #define BUF_LEN 4096 |
| 10 | #define ARROW_LEN 3 |
| 11 | |
| 12 | typedef enum { |
| 13 | NO_KEY, P_KEY, Q_KEY, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, INCOMPLETE, UNKNOWN |
| 14 | } keypress; |
| 15 | |
| 16 | int add_to_buf(uint8_t *input, uint16_t input_length); |
| 17 | |
| 18 | keypress parse_input(); |
| 19 | |
| 20 | void break_unfinished(); |
| 21 | |
| 22 | #endif |