Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Anyway to know if a user presses the window close button or if it can be disabled?

Author
Message
Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 12th Sep 2017 10:10
When my game is closed properly via an in game button I created I run a function just before calling END to save a configuration file, I cannot seem to find a function that will check if the uses pressed the windows close button 'x' so I can call this function before END.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 12th Sep 2017 12:08
How often do you change the configurations? If only now and then, I would save it when changes have been made.
13/0
Supertino
6
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 13th Sep 2017 08:30
Ah yes there are ways around it, currently i simply save the file every 3 seconds, in my use case I have a timer that ticks as the game is playing and the timer has to continue where it left off when the game is relaunched, so I was saving when certain actions happened in game and when the user quit the game (properly). As I cannot capture the user pressing the window close button it left a gap, as the timer does not need to be correct to the very seconds I have worked around it.

Would be nice to instead of the program closing with the 'x' it just returned an AppTerminated() function or similar and allow the programmer to decide what happens. Maybe I'll suggest it.

Login to post a reply

Server time is: 2024-04-23 19:55:42
Your offset time is: 2024-04-23 19:55:42