jtmm2/include/input.h

39 lines
592 B
C

#ifndef _DEF_INPUT
#define _DEF_INPUT
#include <gint/defs/types.h>
#define KEYS_COUNT 4
enum {
K_LEFT,
K_RIGHT,
K_UP,
K_DOWN
};
enum {
S_PRESSED,
S_DOWN,
S_RELEASED,
S_UP
};
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);
/* display all key states */
void input_draw(Input *input);
int input_is_pressed(Input input, uint8_t key);
int input_is_down(Input input, uint8_t key);
int input_is_released(Input input, uint8_t key);
#endif /* _DEF_INPUT */