Page 1 of 1

LVG - Loveable vector graphics ;)

Posted: Thu Sep 06, 2018 1:20 pm
by Bananicorn
I needed SVGs for my game, so I wrote a simple SVG parser, but I'd happily add more features in the future (I'm only having trouble *filling* complex shapes, since I can't use the löve-native triangulate function for that)
https://github.com/Bananicorn/lvg

Have a look and tell me what features you'd need for your projects! :)

Re: LVG - Loveable vector graphics ;)

Posted: Thu Oct 11, 2018 2:14 am
by bobbyjones
What license is this available under. I recommend MIT. Also I might use this in my project.

Re: LVG - Loveable vector graphics ;)

Posted: Thu Oct 11, 2018 4:53 am
by ivan
It's a good start. I've written similar things in the past, but it's hard to support all of the features from the SVG format.
My suggestion would be to separate the rendering from the parser so there is no "love." code in the project.
Anyways good luck!

Re: LVG - Loveable vector graphics ;)

Posted: Wed Oct 24, 2018 2:42 pm
by Bananicorn
bobbyjones wrote: Thu Oct 11, 2018 2:14 am What license is this available under. I recommend MIT. Also I might use this in my project.
As it stands, I simply forgot to add a license - whoops
I guess I'd go for the zlib license, like Löve itself.
I'll add a license file right now, so you can safely use it for whatever you use Löve itself :)
Edit:
zlib license added!
Btw, feel free to tell me what you think would be the next most important feature to be added, the list is so long, I can barely decide ;)

Re: LVG - Loveable vector graphics ;)

Posted: Wed Oct 24, 2018 2:51 pm
by Bananicorn
ivan wrote: Thu Oct 11, 2018 4:53 am It's a good start. I've written similar things in the past, but it's hard to support all of the features from the SVG format.
My suggestion would be to separate the rendering from the parser so there is no "love." code in the project.
Anyways good luck!
Thanks! :)
I actually stumbled upon your library just today, while researching a problem I encountered.
I didn't pay too much attention to sepearating parsing from rendering, because I'm already using love.math.newBezierCurve in my parser and I didn't want to code my own implementation, which would have ended up much slower and more error-prone^^
That being said, it would certainly be much cleaner and more reuseable if I did that, maybe I'll have a look at how you handled Beziers in your library ;)
I'm definitely gonna take some inspiration from you - if I actually *steal* a piece of code, I'm gonna credit you of course :)

Re: LVG - Loveable vector graphics ;)

Posted: Wed Oct 24, 2018 4:05 pm
by ivan
Thanks Bananicorn, sure be my guest. My code is an interesting experiment of what can be done in pure Lua, but only useful for education purposes:
viewtopic.php?f=5&t=78537&start=20#p195245 (requires an old version of Love2D)
I wrote a software implementation for Bezier curves, it was not very good (in particular, estimating the length of the curves needs work). BTW, there are much harder problems to tackle in pure Lua like triangulation, stroke, fill rules, gradients, etc. So yea, perhaps you're better off using Love2D's built-in functionality.
Good luck!