Code: Select all
local canvas
local snap = {x=32, y=32}
love.load = function()
width, height = love.graphics.getWidth(), love.graphics.getHeight()
canvas = love.graphics.newCanvas()
canvas:renderTo(function()
love.graphics.clear()
love.graphics.setColor(224/255, 224/255, 224/255, 0.5)
local linex, liney = 0, 0
-- v lines
for x = 0, width do
linex = x * snap.x
love.graphics.line(linex, 0, linex, height)
end
-- h lines
for y = 0, width do
liney = y * snap.y
love.graphics.line(0, liney, width, liney)
end
-- origin
love.graphics.setColor(224/255, 224/255, 224/255, 1)
love.graphics.line(0,0,width,0)
love.graphics.line(0,0,0,height)
end)
end
love.draw = function()
love.graphics.draw(canvas)
end
Running love-11.3-x86_64.AppImage
-- on --
Pop!_OS 21.04 64 bit
AMD Ryzen 7 2700 8 core
Radeon RX 580