Added a message box popup asking to quit the game to the default error handler, activated when the mouse is pressed or the screen is tapped. This is mostly useful on mobile devices where users can't press 'escape'.

This commit is contained in:
Alex Szpakowski
2015-07-02 23:15:37 -03:00
parent bf432aff7c
commit 8656797c5c
2 changed files with 31 additions and 6 deletions
+9 -2
View File
@@ -633,9 +633,16 @@ function love.errhand(msg)
for e, a, b, c in love.event.poll() do
if e == "quit" then
return
end
if e == "keypressed" and a == "escape" then
elseif e == "keypressed" and a == "escape" then
return
elseif e == "mousereleased" then
local name = love.window.getTitle()
if #name == 0 then name = "Game" end
local buttons = {"OK", "Cancel"}
local pressed = love.window.showMessageBox("Quit "..name.."?", "", buttons)
if pressed == 1 then
return
end
end
end