24 state_machine->
state = UNDEFINED;
58 if (new_state >= 0 && new_state < state_machine->num_infos)
64 state_machine->
state = new_state;
69 state_machine->
state = UNDEFINED;
void * list_itr_next(ListItr *itr)
bool list_remove_data(List *list, void *data)
#define LIST_DEFAULT
Default list declaration for empty lists.
void list_push_back(List *list, void *data)
ListItr list_itr_create(List *list)
void(* StateCallback)(void)
State machine callback function pointer type.
void state_machine_remove(StateMachine *state_machine)
Remove a statemachine's update function.
void state_machine_register(StateMachine *state_machine)
Register a statemachine to run it's update function once per frame.
void noop(void)
no operation
void state_machine_change_state(StateMachine *state_machine, int new_state)
Calls the current state's on_exit, the new state's on_init, and sets the active update fn.
void state_machine_update(void)
Update registered state machines' update functions.
StateInfo * state_infos
Array of StateCallbacks , one entry per state.
bool registered
Flag to determine if statemachine is already running it's active_update function.
int state
The current state of the state machine, the offset into state_infos.
unsigned int num_infos
Number of elements in the state_infos array.
StateCallback active_update
Pointer to the active update function in state_infos
Utilities relating around number string representation and protected arithmatic helper functions.