Files
love-luigi/luigi/backend.lua
Bernhard Liebl 03ad922a65 fixes for löve 11.0 (#60)
Changed all color values to be in the range 0-1, rather than 0-255
2018-04-17 15:22:16 -04:00

28 lines
751 B
Lua

local ROOT = (...):gsub('[^.]*$', '')
local Backend
if _G.love and (_G.love._version_major or _G.love._version_minor) then
Backend = require(ROOT .. 'backend.love')
else
Backend = require(ROOT .. 'backend.ffisdl')
end
Backend.intersectScissor = Backend.intersectScissor or function (x, y, w, h)
local sx, sy, sw, sh = Backend.getScissor()
if not sx then
return Backend.setScissor(x, y, w, h)
end
local x1 = math.max(sx, x)
local y1 = math.max(sy, y)
local x2 = math.min(sx + sw, x + w)
local y2 = math.min(sy + sh, y + h)
if x2 > x1 and y2 > y1 then
Backend.setScissor(x1, y1, x2 - x1, y2 - y1)
else
-- HACK
Backend.setScissor(-100, -100, 1, 1)
end
end
return Backend