Animated vector graphics for LÖVE.
TÖVE is a vector drawing canvas for LÖVE, think HTML5's <canvas>
or OpenFL's Graphics
. Which you can animate. Efficiently.
There have been various libraries for drawing vector graphics out there, but few of them are built for drawing or even animating complex scenes and most of them stopped at the most basic features.
As an example, take the HTML5 <canvas>
tag: it's great in terms of quality, yet it's slow for animation or games, as it doesn't know how to keep its graphics data retained on the GPU: indeed, it will do a full redraw of the whole scene on each frame.
You can use WebGL, but then you lose vector graphics. There have been attempts to fix this by implementing vector graphics on top of WebGL, such as PIXI SVG and the ThreeJS SVG Loader. TÖVE is exactly like these, only more comprehensive. And for LÖVE.
- brings crisp vector graphics and SVGs to LÖVE
- offers a substantial subset of SVG
- built for realtime scaling and animation
- details: https://poke1024.github.io/tove2d/features
Releases are available for macOS, Linux and Windows: https://github.com/poke1024/tove2d/releases.
Some tutorials and general information on TÖVE are found in TÖVE's documentation.
Be sure to check out TÖVE's API documentation, which gives you detailed information on classes and functions.
Note: on Windows, in order to run the demos, you need to call setup.bat
once (this
will fix the links to the lib and asset folders, so you can run e.g. love demos/blob
).
git clone --recurse-submodules https://github.com/poke1024/tove2d
cd tove2d
scons
love demos/hearts
# in git bash:
git clone --recurse-submodules https://github.com/poke1024/tove2d
cd tove2d
# in regular cmd shell:
cd path/to/tove2d
setup.bat /C
Take a look inside setup.bat
to learn more about installing a compiler environment.
Use scons --arch=sandybridge
or scons --arch=haswell
to compile for a custom CPU architecture. On Windows, this enables AVX extensions,
which mainly speeds up the rasterizer dithering code.
On POSIX, in addition, you can enable hardware intrinsics for 16-bit floating point operations by using scons --f16c
. These intrinsics
might give small performance benefits in the gpux
mode.
Since enabling custom options causes crashes on some CPUs (#24), I strongly recommend sticking to the defaults, as they ensure that your binary will run on many CPUs.
I keep my ideas of what might eventually end up in TÖVE in TÖVE's Public Trello Board.
TÖVE is licensed under the MIT license.
Details and the licenses of the included third party code are found in the LICENSE file.
TÖVE owes a lot to Mikko Mononen's excellent NanoSVG. Not only does TÖVE call NanoSVG in various places, it has also inherited some of its code.
TÖVE's API was inspired by EaselJS and PlotDevice.
The graphics you see in the tutorials and demos are by Mike Mac, Kenney and Chris Hildenbrand. The font in the demos is "amatic" by Vernon Adams.
TÖVE is a portmanteau of LÖVE, Towards Vector Graphics and Tove Jansson, the Swedish author and illustrator of the Moomins.
- For a pure-lua implementation of SVG rendering, look at Lovable Vector Graphics: https://github.com/Bananicorn/lvg
- A super-elegant NanoSVG wrapper can be found at https://love2d.org/forums/viewtopic.php?f=5&t=86419