Issue #39 resolved

OS Menu Functions

created an issue

I think it would be neat if we could capture what happens when you click an option in the menubar. Like the Quit, Minimize, etc. These are OS-related menus, but should still let us decide what happens when we click them.

For instance Quit. On OS X it's under the love menu, on Windows under the icon in the title bar and is called "Close". Right now, it just quits the app outright. Shouldn't it be capturable? So we can show "Are you sure?" dialogs and save the game first, etc.

And Minimize. Well, it'd be smarter if we could detect when the game window was minimized. In case we want to pause the action so it doesn't keep playing in the background.

I guess I'm proposing some functions like love.menuOnQuit(), love.menuOnMinimize(), love.menuOnRestore(), (To go with Minimize) and on OS X, love.menuOnHide() and love.menuOnShow().

Comments (4)

  1. Andrzej Giniewicz

    The quit part is already done in ticket #24 iirc. Other than that, I think only minimize/restore is possible in current SDL, right? Using SDL_ActiveEvent probably? Might be nice. I'd also vote for love.minimize and love.restore callbacks (or whatever the names could be), for example to make stuff like pause the game, mute the sound and similar stuff when minimized... I don't see other uses for it though

  2. Jasoco reporter

    Well, those really are the only uses for the most part. When you minimize, most of the time you'll want the game to pause. Would be nice if OS X could also detect hide and show and treat them the same as minimize and restore. Would really like to capture Quit though. Since if I quit through the game interface, I can do whatever I want before the Quit command is pushed. But if I press Command+Q in OS X, or choose Quit from the menu, or Close on Windows, or Control+F4 on Windows, all standard Quit/Close commands, the game just quits. No warning the user. This seems incorrect. It should let you capture the Quit and code it how you want it to quit. To prevent accidental quitting.

    Also, another thing we could capture is focus. Like when the game window becomes covered by another app window. i.e. loses front focus. This would also be useful to pause the game when you switch to Excel because your boss entered the room, or what have you.

    I didn't know Quit had been resolved. I didn't see it in the list because I didn't realize the default list was not "All" issues. My fault. I am new to this system.

  3. Log in to comment