I’m trying to draw some grids with draw_line(for tilemap someday).
However, there is some blurred lines on right side.
Any way to resolve these annoying lines?
Thanks.
(Defold Engine 1.2.103 (d126b03))
local TILE_SIZE = 16
-- 720px
local SCREEN_WIDTH = tonumber(sys.get_config("display.width"))
-- 720px
local SCREEN_HEIGHT = tonumber(sys.get_config("display.height"))
function update(self, dt)
drawGrid()
end
function drawGrid()
local color = vmath.vector4(0.25, 0.25,0.25, 1)
local line_count = SCREEN_WIDTH / TILE_SIZE
local x = 0
for i=1, line_count do
msg.post("@render:", "draw_line", { start_point = vmath.vector3(0, x, 1), end_point = vmath.vector3(SCREEN_WIDTH, x, 1), color = color } )
msg.post("@render:", "draw_line", { start_point = vmath.vector3(x, 0, 1), end_point = vmath.vector3(x, SCREEN_HEIGHT, 1), color = color } )
x = x + TILE_SIZE -1
msg.post("@render:", "draw_line", { start_point = vmath.vector3(0, x, 1), end_point = vmath.vector3(SCREEN_WIDTH, x, 1), color = color } )
msg.post("@render:", "draw_line", { start_point = vmath.vector3(x, 0, 1), end_point = vmath.vector3(x, SCREEN_HEIGHT, 1), color = color } )
x = x + 1
end
end