I just have an enum in my root-class (OOP, Always!) wich says INTRO, MENU, LOADING, GAME etc. And then in my Menu-class i have an enum like MAIN, OPTIONS, VIDEO, GRAPHICS etc.
Then in update and draw i just switch the enum. Makes it easy to make everything fit seamlessly into each other(resourceloading, maploading etc).. Also in the beginning of update and draw i make sure to do stuff like
If(!this->Environment->Map->IsLoaded() && this->State == GAME){ this->State = MENU; }
This way i dont have to deal with the states all the time ( if i just do Map->Unload() it'll return to menu automatically)
This is ok for less complex games, but as your games complexity increases you might want to make a state machine.
My take on the state machine is to create an interface class GameState, which has virtual functions for input, updating, and rendering. Creating a game state is basically inheriting GameState and implementing the virtual functions (Input for events, update for game logic, and render for drawing stuff).
Next I make a class called StateStack, which holds a vector of GameStates. The StateStack class has functions for pushing and popping states, getting a pointer to the active state, etc. Popping a state off the StateStack will activate the new bottom of the StateStack.
Then in your game loop you'll want to have it setup like so:
mStateStack.Push(new Map_GameState);
while(running) {
while(logic timestep stuff) {
while(pollevent(evt)) {
mStateStack.GetTop()->OnEvent(evt, input);
}
mStateStack.GetTop()->OnUpdate(delta);
}
mStateStack.GetTop()->OnRender(window);
window.Display();
}
You might want to do some research on Stacks too.