bevy_prototype_lyon
enables Bevy users to draw 2D shapes and paths, like triangles, circles, rectangles, lines, arcs and beziers.
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.
Geometry
traitlyon_tessellation v0.17
lyon_tessellation v0.17
, unfortunately rectangles with rounded borders are no longer supported.Quad
, Triangle
and Polyline
have been substituted by a general-purpose Polygon
shape.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
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!