Well the answer is what you kind of already stated. It just makes the work for the programmer a little easier. I mean imagine if you didn't use enumerations in that switch case it would probably look something like this:
switch ( g_eGameMode )
{
// initial setting up of the game
case 1:
gameSetup(); break;
// resetting the game after the player looses a life, or before a new game starts
case 2:
gameReset(); break;
// display the main title screen
case 3:
gameTitle(); break;
// wait for the player to press fire to start
case 4:
gameWaitForFire(); break;
}
Now to switch to each game mode like gameReset() and gameTitle() you would have to do something like this in the code:
Now when it comes to game projects the amount of game modes that you are going to have is more than likely going to get pretty big I mean even in the dark invaders game it has quite a few. So it would get very confusing as to what game mode is associated with what number. So rather than making your life more confusing and anyone else who is going to see your code just use an enumeration of game modes. So using the dark invaders game as an example. You create an enumeration of all the game modes you are going to have.
enum eMode { eGameSetup , eGameReset , eGameTitle , eGameWaitForFire , eGameLevel , eGameLevelWait , eGameLevelWait2 , eGamePlay , eGameDie , eGameWin , eGameOver };
eMode g_eGameMode = eGameSetup;
For the switch case rather than putting the hard codes numbers you just put the name of the game mode that it is associated with like this:
switch ( g_eGameMode )
{
// initial setting up of the game
case eGameSetup:
gameSetup(); break;
// resetting the game after the player looses a life, or before a new game starts
case eGameReset:
gameReset(); break;
// display the main title screen
case eGameTitle:
gameTitle(); break;
// wait for the player to press fire to start
case eGameWaitForFire:
gameWaitForFire(); break;
}
So when you want to switch game modes you would just have to do this:
g_eGameMode = eGameTitle;
rather than having to remember what numbers go with what game mode. Just makes things much easier.
Hope this helps.