Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


The obscure art of makin' a menu

This topic is 6178 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

(Previously posted on GCUK forums - www.gamecoding.co.uk/forums) This one another of my problems that''ve been bugging me off for the last weeks: while(1){ if(key[KEY_UP] && (p > 0)){ poll_keyboard(); p--; } if(key[KEY_DOWN] && (p < 2)){ poll_keyboard(); p++; } if(key[KEY_ENTER]){ switch(p){ case 0: // New Game // caca break; case 1: // Credits // caca break; case 2: // Exit // caca break; } } } So? Yep. That menu won''t work. I mean the keyboard reads, but the last if-statement don''t work. Normally the while()-sling should exit, but nothing happens. Help? //toki

Share this post

Link to post
Share on other sites
I think the breaks you put in that switch-thingy just break out of the switch loop, not the while loop. You could build the while loop like this:
while( !bDone )

Then in the switch statement you could set bDone to true, and the while loop would end.

BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post

Link to post
Share on other sites
Original post by Freeride Designs
Or you could have


That break would never execute, since as soon as the continue is reached, you jump to the conditional in the while. The loop would still be infinite.

Jappie has a good solution.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!