Archived

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

Rattlehead

"Press Any Key..."/getch() type stuff in VS.NET?

Recommended Posts

Hi all! I''ve set up my game so that when one player or the other has hit the score limit the game shows a victory screen and then exits back to the title screen. At present, I just put in a Sleep() to hold it there long enough for the players to see it and then it goes back to the title. But I''m thinking about setting it up so that they can "press any key to continue". So it will show the screen and then wait for a keypress to return to the title screen. Back in the old DOS days, I''d just use a call to getch() which would wait for keyboard input. But, now I''m using VS.NET and working in Windows with DirectX. So does anyone know a good way to accomplish this? Hopefully a simple way that doesn''t require much support from outside my EndGame() function... Rattlehead

Share this post


Link to post
Share on other sites
You could do something like this:



while (inputEngine->getKeyState() != KEY_PRESSED)
{
graphicsEngine->display(&victory_screen);
}
graphicsEngine->display(&title_screen)


I think you''ll need a separate thread for the input. Basically, you need one thread for the "graphic pipeline" and one for the input. So display the victory screen until input is detected, then send the title screen down the pipe—or something like that.


"Do not flame people you don''t know in a public forum. Only amateurs do that. Professionals in the industry know they will run into each other over and over. The person you flame this year may the person you want to do business with next year. Don''t burn your bridges," (Diana Gruber, http://www.makegames.com/chapt6.html).

Share this post


Link to post
Share on other sites
Thanks for the replies guys, but I''ve decided to just accept the ESC key. They code for that is already in place and it''s logical enough.

The program I''m doing is really super simple and I can''t see going to too much trouble for this. Call me lazy, but ESC will work fine... :D

Rattlehead

Share this post


Link to post
Share on other sites