interference/include/input.h

33 lines
506 B
C

#pragma once
/* CODE FROM FISFOR */
typedef enum Key {
K_A,
K_B,
K_X,
K_UP,
K_DOWN,
K_LEFT,
K_RIGHT,
K_EXIT,
K_COUNT
} Key;
typedef enum KeyState { KS_UP, KS_RELEASE, KS_DOWN, KS_PRESS } KeyState;
typedef struct Input {
int keys[K_COUNT];
KeyState states[K_COUNT];
} Input;
/* called by main.c once */
void input_init(void);
/* call this to update key states once per frame */
void input_step(void);
int input_down(Key);
int input_pressed(Key);
int input_up(Key);
int input_released(Key);