The Mach5 Engine itself also has its own implementation of a State Machine, using inheritance to allow users to not have to rewrite the base functionality over and over again and using function pointers instead of having one function for each state. A function pointer is what it sounds like--a pointer to the address in memory where the function is--and we can call it from that information.
You can take a look at the base version of one here, starting with the Header file:
#ifndef M5STATEMACNINE_H #define M5STATEMACNINE_H #include "M5Component.h" #include ...