crystal-tower/inc/input.h

22 lines
513 B
C
Raw Normal View History

2021-11-09 22:34:40 +01:00
#pragma once
/* use this to get user input, NOT gint/keyboard.h */
2021-11-10 23:29:12 +01:00
enum Key { K_JUMP, K_PUNCH, K_UP, K_DOWN, K_LEFT, K_RIGHT, K_EXIT, K_COUNT };
2021-11-09 22:34:40 +01:00
enum KeyState { KS_UP, KS_RELEASE, KS_DOWN, KS_PRESS };
struct Input {
int keys[K_COUNT];
enum KeyState states[K_COUNT];
};
/* called by main.c once */
void input_init(void);
/* call this to update key states once per frame */
void input_update(void);
int input_down(enum Key);
int input_pressed(enum Key);
int input_up(enum Key);
int input_released(enum Key);