love
love copied to clipboard
lineCaps and lineJoins
Original report by Karl Hobley (Bitbucket: kaedroho, GitHub: kaedroho).
lineCaps and lineJoins are very handy as they let you have things like smooth lines. I imagine the implementation won't be that easy but it will improve the quality of LOVE games. This is a feature found in HTML5 canvases
Heres a couple of HTML5 tutorials describing how these are done in HTML5
- http://www.html5canvastutorials.com/tutorials/html5-canvas-line-caps/
- http://www.html5canvastutorials.com/tutorials/html5-canvas-line-joins/
Original comment by Matthias Richter (Bitbucket: vrld, GitHub: vrld).
Line-join-modes have been on my to-do for some time, thogh only as 'none' (equivalent to several calls to love.graphics.line()), 'miter' (as it is now) and 'bevel' (see also here). A round line join could probably be added to the list too, though it wouldn't play too nice with the internal implementation - especially with anti-aliasing.
Similar things go for line caps: A square cap is simple enough, but the round one is more complicated.
Original comment by Karl Hobley (Bitbucket: kaedroho, GitHub: kaedroho).
In my game, I got "round" line caps by simply drawing circles at each end of the line and it actually looks alright. Obviously not a great solution though but it might work as a temporary fix
Original comment by Matthias Richter (Bitbucket: vrld, GitHub: vrld).
Half of it fixed as of a9e1ef3
Original comment by SpotlightKid (Bitbucket: SpotlightKid, GitHub: SpotlightKid).
I get this error when trying to use love.graphics.getLineJoin()
:
Error: main.lua:89: Unknown line join
stack traceback:
[C]: in function 'getLineJoin'
main.lua:89: in function 'draw'
[string "boot.lua"]:438: in function <[string "boot.lua"]:399>
[C]: in function 'xpcall'
Manjaro Linux x86_64 with LÖVE installed from package manager (love 0.9.1-1)
Original comment by Sasha Szpakowski (Bitbucket: slime73, GitHub: slime73).
That's already fixed for LÖVE 0.9.2.
Original comment by SpotlightKid (Bitbucket: SpotlightKid, GitHub: SpotlightKid).
Ah, ok. I only searched the changelog for the function name so I missed the entry.
Original comment by Sasha Szpakowski (Bitbucket: slime73, GitHub: slime73).
In the meantime adding this to the top of your main.lua should make getLineJoin
work as expected, I think: love.graphics.setLineJoin("miter")
.
Original comment by SpotlightKid (Bitbucket: SpotlightKid, GitHub: SpotlightKid).
Yes, I figured that out. Since I'm using getLineJoin
in a function to save an unknown state, I did this at the top of the module:
if not pcall(love.graphics.getLineJoin) then
love.graphics.setLineJoin('miter')
end