Exit Game

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Yagani
Posts: 17
Joined: May 19th, 2013, 3:31 pm

Exit Game

Post by Yagani » June 30th, 2013, 9:12 am

Hey,

how do you exit a game properly with all the destructors being called?

Yagani

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Exit Game

Post by LuX » June 30th, 2013, 1:07 pm

If I'm not mistaken destructors are called automatically when the class gets erased, eg. the program shuts down.

You can shut down a program by calling "exit ( 0 );". I read about the exit function, since I used exit(1) usually, that exit(0) and (1) are basically the same, but if you use error handling it is wise to use exit(0) when the shut down is intentional and exit(1) when you shut it down because of an error.
ʕ •ᴥ•ʔ

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Exit Game

Post by LuisR14 » June 30th, 2013, 1:52 pm

IMO, for GUI based windows apps it is better to use PostQuitMessage
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Yagani
Posts: 17
Joined: May 19th, 2013, 3:31 pm

Re: Exit Game

Post by Yagani » June 30th, 2013, 4:31 pm

Neither of Lux's options worked for me while LuisR14's option did work, thx guys.

Yagani

Post Reply