A simple example of different screens/menus/surfaces:
class Surface
{
virtual ~Surface();
virtual void Run() = 0;
};
class MainMenu : public Surface
{
virtual void Run();
};
class Game : public Surface
{
virtual void Run();
};
// In your main game loop
while (inLoop)
{
surface->Run();
}
Transitions from one to the other surface can be realized through the return value of Run(). A possibility is an enum and a std::map that maps the enum to the different surfaces. (In fact, boost::ptr_map might be more appropriate, but the principle remains the same.)
enum SurfaceEnum {InGame, InMainMenu, Exit, ...};
std::map<SurfaceEnum, Surface*> map;
map[InGame] = new Game;
map[InMainMenu] = new MainMenu;
// delete everything in the end
Then, the main loop can look like this:
SurfaceEnum next = InMainMenu;
while (next != Exit)
{
surface = map[next];
next = surface->Run();
}
That's just one of many possibilities