35 lines
561 B
C
35 lines
561 B
C
|
#pragma once
|
||
|
|
||
|
/* FROM FISFOR */
|
||
|
/* use this to get user input, NOT gint/keyboard.h */
|
||
|
|
||
|
typedef enum Key {
|
||
|
K_A,
|
||
|
K_B,
|
||
|
K_UP,
|
||
|
K_DOWN,
|
||
|
K_LEFT,
|
||
|
K_RIGHT,
|
||
|
K_EXIT,
|
||
|
K_X,
|
||
|
K_Y,
|
||
|
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);
|