You can use the [wiki]love.visible[/wiki] callback, it will be called with false when the window is minimized and true when it has been opened again. There is also [wiki]love.focus[/wiki] and [wiki]love.mousefocus[/wiki] that may also help.
When the window is maximized [wiki]love.resize[/wiki] is called whith the new dimensions, but is difficult to tell if the event came from pressing maximize or simply by resizing the window so you may get non-expected behaviour here, maybe use a resize treshold, like if the window is resized too suddenly then a human couldn't have done it or something like that, maybe you can use the screen size to tell if the size passed to love.resize is similar... Not sure
For the close button there is [wiki]love.quit[/wiki] this gets called whenever the LÖVE window is expected to close, if love.quit returns true then the game won't quit so you can make it do whatever you like instead of closing, you should provide a way to quit though, so maybe set an internal variable when actually quitting that is not commonly set by just pressing the exit button, say:
Code: Select all
local quit = false
love.keyreleased = function (k)
if k == "escape" then
quit = true
love.event.quit()
end
end
love.quit = function ()
if not quit then
--Do whatever you like
return true
end
end
I'm not sure if you can unminimize though, I don't think that calling [wiki]love.window.minimize[/wiki] when the window is already minimized does something, you could try [wiki]love.window.maximize[/wiki] but I don't think that would work either, so I don't think you can stop the standard behaviour, unless you add a function to LÖVE maybe, not sure.
I will investigate if there is something in SDL and try writting an FFI wrapper if there is, hope this helps!