crystal-tower/inc/input.h

22 lines
513 B
C

#pragma once
/* use this to get user input, NOT gint/keyboard.h */
enum Key { K_JUMP, K_PUNCH, K_UP, K_DOWN, K_LEFT, K_RIGHT, K_EXIT, K_COUNT };
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);