verdant
See boids.rs
See clock.rs
See paint.rs
Verdant is a work-in-progress. The API may change at any time.
What is Verdant?
Verdant is a rendering and windowing library for Rust.
Built on top of wgpu and winit, Verdant focuses on a clean, expressive, and easy-to-use API that makes common rendering tasks easy and difficult mistakes hard to make.
use ;
Verdant aims to be performant and powerful, while still remaining lightweight and nice to use.
Why Verdant?
SDF-based rendering
Almost all Verdant primitives are rendered using SDFs (signed-distance-fields). This allows for your graphics to have perfect anti-aliasing and rounding, at any scale, while remaining efficient.
Multiple windows are first-class
Most graphics libraries start with a single window and treat additional windows as an advanced feature. Verdant easily and cleanly supports multiple windows, built into the API since day one.
See multi_window.rs
Scoped state
Most graphics libraries have functions like push_state and pop_state.
This is powerful, but it can lead to mistakes where state is leaked out of the context where you need it.
Verdant prevents this by providing scoped state through closures.
See scoped_state.rs
Pick your API
Verdant doesn't force you to stick to a state machine API or a more "retained" builder pattern API, instead allowing you to choose between either one.
See drawing.rs
Rich text
Verdant provides both a basic text API and a rich text API, allowing you to mix fonts, colors, sizes, and styles, all in a single function call.
See rich_text.rs
Canvases are first-class
Verdant allows you to render to off-screen surfaces just as easily as rendering to a window.
Views and coordinate systems
Verdant allows you to define a logical rendering space, independent of the physical window size. This allows you to create scalable applications without having to manually handle aspect-ratio math.
See views.rs
Installation
Add this to your Cargo.toml:
[]
= "0.4"
Currently, Verdant only supports desktop, though web/mobile support is planned soon.
(Windows and Linux have been tested, and macOS is currently untested)
Cargo Features
By default, Verdant includes image and text features. If you don't need asset loading and/or text and want a lighter dependency tree, you can disable them:
[]
= { = "0.4", = false }
Running the Examples
To try out the examples locally, clone the repository and run them using Cargo:
Feedback
For any feedback on the API or for feature requests, please go to the issues page.
License
Verdant is licensed under MPL-2.0.
Applications built with Verdant may be distributed under any license. Only modifications to Verdant itself are required to remain MPL-licensed.