• Advertisement
Sign in to follow this  

overall structure

This topic is 2192 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is this a good overall structure for a game? Or not so much?



enum game_menu_choice {PLAYGAME, INSTRUCTIONS, EXIT};

int main(void)
{

do {

game_menu_choice user_choice = get_user_choice();

switch(user_choice)
{
case PLAYGAME:
Playgame();
break;

case INSTRUCTIONS:
Show_Instructions();
break;

case EXIT();
exit(0);
break;


};


} while(1);







}

Share this post


Link to post
Share on other sites
Advertisement
Looks like a good start. I would probably use a while(true) loop rather than the less common do { ... } while loop, and I'd also return from main rather than calling exit(), but these are minor stylistic issues.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement