love 0.9.2 support

This commit is contained in:
airstruck
2015-10-28 05:37:42 -04:00
parent 18f51c2ac3
commit 31b77234f5
4 changed files with 34 additions and 6 deletions

View File

@@ -101,6 +101,22 @@ function Layout:unhook ()
self.hooks = {}
end
local getMouseButtonId
local major, minor, revision, codename = love.getVersion()
if minor < 10 then
getMouseButtonId = function (value)
return value == 'l' and 1
or value == 'r' and 2
or value == 'm' and 3
end
else
getMouseButtonId = function (value)
return value
end
end
function Layout:manageInput (input)
if self.isManagingInput then
return
@@ -115,11 +131,11 @@ function Layout:manageInput (input)
end)
self:hook('mousepressed', function (x, y, button)
self.isMousePressed = true
return input:handlePressStart(button, x, y)
return input:handlePressStart(getMouseButtonId(button), x, y)
end)
self:hook('mousereleased', function (x, y, button)
self.isMousePressed = false
return input:handlePressEnd(button, x, y)
return input:handlePressEnd(getMouseButtonId(button), x, y)
end)
self:hook('mousemoved', function (x, y, dx, dy)
if self.isMousePressed then