Skip to main content
GameDev.net gamedev.net
🔒 Locked

ending a program

Started by crispyraccoon Oct 13, 2008 at 7:22 PM 3 replies 750+ views
Original Post
crispyraccoon
crispyraccoon
I'm making a simple race.. thing, not really a game, but i suppose you could bet on it. What i am wanting to do is this:(as an algorithm) if the car goes past a point, clear everything from the screen, pop-up window "CAR (x) WINS!" with options "Rematch" and "Exit" what i have is: if car goes past a point, clear previous drawing above for function, create text in window "Car (X) Wins!" // it also continues to move, which i can fix. This is running in WinXP also. THANKS!
Driv3MeFar
Driv3MeFar
What, exactly, is your question? How to gracefully exit a program when prompted to do so? How to reset the game state?
crispyraccoon
crispyraccoon
How to get a dialog box with options to either reset or exit.
VanillaSnake21
VanillaSnake21
umm well the most simplistic way would be something like MessageBox(NULL, 0,0 MB_RETRYCANCEL); Then you handle each each click, depending on which item was pressed ( do it through the WinProc). I am assuming you know how to handle click messages. If you want something more complex then you should make your own dialog box (google that) and then create your own buttons on it. Then you handle them in a similar fashion, having two functions for example OnClickQuit() and OnClickRetry(). Heres a site on how to make dialog boxes (it uses MFC) Here

P.S I think that the program will automatically pause because the dialog box will get the focus.
You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.