mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-09 15:58:22 +00:00
fixes for löve 11.0 (#60)
Changed all color values to be in the range 0-1, rather than 0-255
This commit is contained in:
committed by
airstruck
parent
3aa71d750b
commit
03ad922a65
@@ -1,7 +1,7 @@
|
|||||||
local ROOT = (...):gsub('[^.]*$', '')
|
local ROOT = (...):gsub('[^.]*$', '')
|
||||||
local Backend
|
local Backend
|
||||||
|
|
||||||
if _G.love and _G.love._version_minor > 8 then
|
if _G.love and (_G.love._version_major or _G.love._version_minor) then
|
||||||
Backend = require(ROOT .. 'backend.love')
|
Backend = require(ROOT .. 'backend.love')
|
||||||
else
|
else
|
||||||
Backend = require(ROOT .. 'backend.ffisdl')
|
Backend = require(ROOT .. 'backend.ffisdl')
|
||||||
|
|||||||
18
luigi/backend/love.lua
Normal file → Executable file
18
luigi/backend/love.lua
Normal file → Executable file
@@ -67,7 +67,19 @@ Backend.quit = function ()
|
|||||||
love.event.quit()
|
love.event.quit()
|
||||||
end
|
end
|
||||||
|
|
||||||
Backend.setColor = love.graphics.setColor
|
if _G.love._version_major >= 11 then
|
||||||
|
Backend.setColor = function(r, g, b, a)
|
||||||
|
if type(r) == "table" then
|
||||||
|
r, g, b, a = unpack(r)
|
||||||
|
end
|
||||||
|
if a == nil then
|
||||||
|
a = 255
|
||||||
|
end
|
||||||
|
love.graphics.setColor(r / 255, g / 255, b / 255, a / 255)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Backend.setColor = love.graphics.setColor
|
||||||
|
end
|
||||||
|
|
||||||
Backend.setCursor = love.mouse.setCursor
|
Backend.setCursor = love.mouse.setCursor
|
||||||
|
|
||||||
@@ -94,7 +106,7 @@ end
|
|||||||
|
|
||||||
local getMouseButtonId, isMouseDown
|
local getMouseButtonId, isMouseDown
|
||||||
|
|
||||||
if love._version_minor < 10 then
|
if love._version_major == 0 and love._version_minor < 10 then
|
||||||
getMouseButtonId = function (value)
|
getMouseButtonId = function (value)
|
||||||
return value == 'l' and 'left'
|
return value == 'l' and 'left'
|
||||||
or value == 'r' and 'right'
|
or value == 'r' and 'right'
|
||||||
@@ -155,7 +167,7 @@ function Backend.show (layout)
|
|||||||
hook(layout, 'textinput', function (text)
|
hook(layout, 'textinput', function (text)
|
||||||
return input:handleTextInput(layout, text, Backend.getMousePosition())
|
return input:handleTextInput(layout, text, Backend.getMousePosition())
|
||||||
end)
|
end)
|
||||||
if love._version_minor > 9 then
|
if (love._version_major == 0 and love._version_minor > 9) or love._version_major >= 11 then
|
||||||
hook(layout, 'wheelmoved', function (x, y)
|
hook(layout, 'wheelmoved', function (x, y)
|
||||||
return input:handleWheelMove(layout, x, y)
|
return input:handleWheelMove(layout, x, y)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user