#include "stdio.h"
#include "stdbool.h"
typedef enum {
INPUT_NONE,
INPUT_FORWARD,
INPUT_BACKWARD,
INPUT_UP,
INPUT_DOWN,
INPUT_ATTACK,
INPUT_END,
} Player_Input;
typedef enum {
STATE_NONE = INPUT_END,
STATE_WALK_FORWARD,
STATE_WALK_BACKWARD,
STATE_CROUCH,
STATE_JUMP,
STATE_DASH,
STATE_BACKDASH,
STATE_ATTACK,
STATE_236_SPECIAL,
STATE_214_SPECIAL,
STATE_22_SPECIAL,
STATE_623_SPECIAL,
} Player_State;
const char * enum_strings[] = {
"INPUT_NONE",
"INPUT_FORWARD",
"INPUT_BACKWARD",
"INPUT_UP",
"INPUT_DOWN",
"INPUT_ATTACK",
"STATE_NONE",
"STATE_WALK_FORWARD",
"STATE_WALK_BACKWARD",
"STATE_CROUCH",
"STATE_JUMP",
"STATE_DASH",
"STATE_BACKDASH",
"STATE_ATTACK",
"STATE_236_SPECIAL",
"STATE_214_SPECIAL",
"STATE_22_SPECIAL",
"STATE_623_SPECIAL",
};
#define INPUT_BUFFER_SIZE 10
typedef Player_Input Input_Buffer[INPUT_BUFFER_SIZE];
void update_inputs(Input_Buffer * input_buffer) {
}
Player_State get_player_state(Input_Buffer input_buffer, Player_State last_state) {
}
void display_input_buffer(Input_Buffer input_buffer) {
for (size_t i = 0; i < INPUT_BUFFER_SIZE; ++i) {
printf("%s\n", enum_strings[input_buffer[i]]);
}
}
void display_player_state(Player_State state) {
printf("%s\n", enum_strings[state]);
}
int main() {
Player_Input input_buffer[INPUT_BUFFER_SIZE] = {
INPUT_FORWARD,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
INPUT_NONE,
};
Player_State player_state = STATE_NONE;
update_inputs(&input_buffer);
player_state = get_player_state(input_buffer, player_state);
display_input_buffer(input_buffer);
putchar('\n');
display_player_state(player_state);
}