Bevy + Lyon = ❤

bevy_prototype_lyon enables Bevy users to draw 2D shapes and paths, like triangles, circles, rectangles, lines, arcs and beziers.

Regular polygon demo

How does it work?

Currently Bevy does not support drawing custom shapes in an easy way. This crate uses a variation of Bevy's SpriteBundle with custom meshes to draw shapes. The lyon crate is used to generate those custom mesh.

Changelog

0.2.0

0.1.5

Usage

Add the following line in your cargo.toml manifest file, under the [dependencies] section:

TOML bevy_prototype_lyon = "0.2"

Then, you can start by drawing simple shapes:

```rust use bevy::prelude::; use bevy_prototype_lyon::prelude::;

fn main() { App::build() .addplugins(DefaultPlugins) .addplugin(ShapePlugin) .addstartupsystem(setup.system()) .run(); }

fn setup(commands: &mut Commands, mut materials: ResMut>) { let circle = shapes::Circle { radius: 100.0, ..shapes::Circle::default() };

commands
    .spawn(Camera2dBundle::default())
    .spawn(GeometryBuilder::build_as(
        &circle,
        materials.add(ColorMaterial::color(Color::AQUAMARINE)),
        TessellationMode::Fill(FillOptions::default()),
        Transform::default(),
    ));

} ```

Don't forget to check out the examples to learn more!