#ifndef _DEF_INPUT #define _DEF_INPUT #include #include #define KEYS_COUNT 5 enum { K_LEFT, K_RIGHT, K_UP, K_DOWN, K_EXIT }; enum { S_PRESSED, /* 0 */ S_DOWN, /* 1 */ S_RELEASED, /* 2 */ S_UP /* 3 */ }; typedef struct Input { uint8_t keys[KEYS_COUNT]; uint8_t states[KEYS_COUNT]; } Input; /* will check for new key inputs and update states[] */ void input_step(Input *input); /* initialize values */ void input_init(Input *input); /* display all keys states and information */ void input_draw_debug(Input *input); bool input_is_pressed(Input *input, uint8_t key); bool input_is_down(Input *input, uint8_t key); bool input_is_released(Input *input, uint8_t key); bool input_is_up(Input *input, uint8_t key); #endif /* _DEF_INPUT */