mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user