mirror of
https://github.com/airstruck/luigi.git
synced 2025-11-18 12:25:06 +00:00
love 0.9.2 support
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
love.filesystem.setSymlinksEnabled(true) -- for older love versions
|
||||
|
||||
local Layout = require 'luigi.layout'
|
||||
|
||||
local style = {
|
||||
|
||||
@@ -52,9 +52,18 @@ function Font:getAdvance (text)
|
||||
return (self.font:getWidth(text))
|
||||
end
|
||||
|
||||
function Font:getWrappedHeight (text)
|
||||
local _, lines = self.font:getWrap(text, self.layout.width)
|
||||
return #lines * self.font:getHeight()
|
||||
local major, minor, revision, codename = love.getVersion()
|
||||
|
||||
if minor < 10 then
|
||||
function Font:getWrappedHeight (text)
|
||||
local _, lines = self.font:getWrap(text, self.layout.width)
|
||||
return lines * self.font:getHeight()
|
||||
end
|
||||
else
|
||||
function Font:getWrappedHeight (text)
|
||||
local _, lines = self.font:getWrap(text, self.layout.width)
|
||||
return #lines * self.font:getHeight()
|
||||
end
|
||||
end
|
||||
|
||||
return Font
|
||||
|
||||
@@ -126,7 +126,8 @@ function Input:handlePressStart (button, x, y)
|
||||
self.passedWidgets[button] = widget
|
||||
self:bubbleEvent('PressStart', widget, {
|
||||
target = widget,
|
||||
button = button, x = x, y = y
|
||||
button = button,
|
||||
x = x, y = y
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user