Idk if this is correct way to do state machine.
Well there are many ways to do a state engines, and many types. Yours just feel pretty good to me, maybe for an engine of this kind you could make your states derivate from a "State" class with virtual methods like an update one, and then make a state array or something like that
!
( Something similar was done in the
SFML Game developpement book wich is duper great )