-
Notifications
You must be signed in to change notification settings - Fork 1
/
fsm.h
31 lines (24 loc) · 858 Bytes
/
fsm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef __FSM__
#define __FSM__
#include "mainmenu_state.h"
#include "play_state.h"
#include "high_scores_state.h"
#include "multiplayer_setup_state.h"
enum fsm_state_action {fsm_state_init, fsm_state_handleEvent, fsm_state_update, fsm_state_render, fsm_state_clean};
enum fsm_state_code {mainmenu, play, high_scores, multiplayer_setup, end};
enum fsm_return_code {ok, back, quit, repeat, menu};
#define FSM_NB_STATES_TRANSITIONS 9
#define FSM_EXIT_STATE end
#define FSM_ENTRY_STATE mainmenu
typedef struct {
enum fsm_state_code currentState;
} s_StateMachine;
void fsm_init(s_Game *game);
void fsm_setState(s_Game *game, enum fsm_state_code state);
void fsm_initState(s_Game *game);
void fsm_handleEvent(s_Game *game, int key);
void fsm_update(s_Game *game);
void fsm_render(s_Game *game);
void fsm_clean(s_Game *game);
char fsm_isRunning();
#endif