Prevent the user from exiting by clicking "Close"

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
LoneArtisan
Prole
Posts: 12
Joined: Thu Apr 11, 2013 6:20 pm

Prevent the user from exiting by clicking "Close"

Post by LoneArtisan »

Nil
Last edited by LoneArtisan on Mon May 26, 2014 8:37 pm, edited 1 time in total.
You know that moment when you finally do that thing you've been trying to accomplish for hours and you finally get it exactly right? No matter how small the task was, it's one of the greatest things that could happen when you're programming!
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Prevent the user from exiting by clicking "Close"

Post by slime »

You can return true from the love.quit event callback function to prevent the game from exiting immediately when the user presses the close button. Just be sure to have some way of quitting that isn't too unintuitive. :)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Prevent the user from exiting by clicking "Close"

Post by raidho36 »

There must be a way to instantly shut the game down. A common way to do that is to have Alt+F4 keycombo that instantly shuts the game down in whatever state it was without any additional processing or activity whatsoever. Note that it must not have any activity. The whole point of it is to shut it down immediately, whereas activity like saving the game data may hang the program opened for a while.
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: Prevent the user from exiting by clicking "Close"

Post by DaedalusYoung »

The problem with that is that people will complain about quitting without saving. I've read complaints from Minecraft players who wanted Cmd-Q (on Mac of course) to quit the game. It didn't work like that, because if you quit without saving, you risk losing progress and even corrupting savefiles. Now they changed it, so Cmd-Q works as expected, but not entirely instantly, as it has to save first.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Prevent the user from exiting by clicking "Close"

Post by raidho36 »

Well there's a red button on window title and menu option to quit regularry, the hotkey is specifically for instant shutdown, of course it won't save anything. Mojang should've replied "by design" and should've not listened to these complaints.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Prevent the user from exiting by clicking "Close"

Post by Azhukar »

raidho36 wrote:Well there's a red button on window title and menu option to quit regularry, the hotkey is specifically for instant shutdown, of course it won't save anything. Mojang should've replied "by design" and should've not listened to these complaints.
"We're sorry, what you're experiencing is intended behavior. We have designed our game in such a way that pressing 2 buttons will corrupt all your progress. This is good design and very intuitive.

Have a nice day."
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: Prevent the user from exiting by clicking "Close"

Post by DaedalusYoung »

I must add that before, Cmd-Q just didn't do anything, so it also wouldn't corrupt the savefile, the only way to quit the game was to hit Esc, then click the 'Save and quit' button. Back in the menu, Cmd-Q worked again.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Prevent the user from exiting by clicking "Close"

Post by raidho36 »

Azhukar wrote: "We're sorry, what you're experiencing is intended behavior. We have designed our game in such a way that pressing 2 buttons will corrupt all your progress. This is good design and very intuitive.

Have a nice day."
Reminds me how one dude complained on Blizzard forum that he could assign his aliases to anything, and Alt+F1 through Alt+F3 are assigned fine, but he couldn't assign an alias to Alt+F4 keycombo - the game would always "crash" without saving his progress.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Prevent the user from exiting by clicking "Close"

Post by Lafolie »

raidho36 wrote:Well there's a red button on window title and menu option to quit regularry, the hotkey is specifically for instant shutdown, of course it won't save anything. Mojang should've replied "by design" and should've not listened to these complaints.
First an foremost, ignoring critique (especially from your userbase) is a terrible idea. Even if you disagree with a given statement, it is wise to at least acknowledge their cries. It is straight-up nonsense to do otherwise. In fact, I'd go as far to say that, other than providing a terrible service/experience/insert-buzzword ignoring your users is the worst thing you can do as the provisional entity/developer.

Secondly, your view towards closing an application is bizarre. Why should a quit process do nothing? In fact, it has to do something, otherwise it's not a process. Cmd+Q is pretty much a global hotkey, and should be expected to work with almost every application (hard to think of examples where it shouldn't, but I'm sure they exist). It is perfectly acceptable to perform light operations during the quit process. This is why Löve has a quit event. An easy, terrific use of this is saving data, provided you're not storing 12 hours worth of gamestates or other such mass quantity of data.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Prevent the user from exiting by clicking "Close"

Post by raidho36 »

First an foremost, ignoring critique (especially from your userbase) is a terrible idea. Even if you disagree with a given statement, it is wise to at least acknowledge their cries. It is straight-up nonsense to do otherwise. In fact, I'd go as far to say that, other than providing a terrible service/experience/insert-buzzword ignoring your users is the worst thing you can do as the provisional entity/developer.
It's one thing when users would complain about flaws. But when users complain about something that is result of their own ignorance/stupidity/misunderstanding/whatever is a whole different story. You should never listen to this kind.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests