I'm making a tile based world editor, and I want the user to be able to toggle a grid. My algorithm works, but I'm constantly drawing a 1000x1000 area of squares. Is there a way I could draw the grid once, and then not draw it again, or just have it draw more efficiently?
Here's my current grid algorithm:
Code: Select all
if editor.grid then
for i=-500,500 do
local precolor = love.graphics.getColor()
love.graphics.setColor(255,255,255,50)
for i2=-500,500 do
love.graphics.rectangle("line",i*40,i2*40,editor.defaultTileSize,editor.defaultTileSize)
end
end
end