To accurately draw lines in love, it is required to offset the coordinates by .5.
nk_love_draw_polyline() causes issues with accurate line rendering, because it ignores this rule and draws lines at integer coordinates.
This is a rectangle drawn with love.graphics.line:
function love.draw()
love.graphics.setLineWidth(1.0)
love.graphics.line(10.5, 10.5, 100.5, 10.5, 100.5, 100.5, 10.5, 100.5, 10.5, 10.5)
end
This is the same rectangle drawn with nk.line:
if nk.windowBegin("window", 0, 0, 200, 200) then
love.graphics.setLineWidth(1.0)
nk.line(10.5, 10.5, 100, 10, 100.5, 100.5, 10.5, 100.5, 10.5, 10.5)
end
nk.windowEnd()
Both rectangles should look identical, with a thickness of 1 pixel. The one drawn by nk.line is 2 pixels wide. It's not possible to draw lines with a thickness of 1 with nk.line.
To accurately draw lines in love, it is required to offset the coordinates by .5.
nk_love_draw_polyline()
causes issues with accurate line rendering, because it ignores this rule and draws lines at integer coordinates.This is a rectangle drawn with
love.graphics.line
:This is the same rectangle drawn with
nk.line
:Both rectangles should look identical, with a thickness of 1 pixel. The one drawn by
nk.line
is 2 pixels wide. It's not possible to draw lines with a thickness of 1 withnk.line
.