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 Bevy's SpriteBundle
bundle and replaces its default quad mesh with a custom mesh.
Here the lyon crate is used to generate that custom mesh.
lyon_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.bevy 0.4.0
.bevy 0.3.0
.Add the following line in your cargo.toml
manifest file, under the [dependencies]
section:
TOML
bevy_prototype_lyon = "0.1.5"
Then, you can start by drawing simple shapes:
```rust use bevy::prelude::; use bevy_prototype_lyon::prelude::;
fn main() { App::build() .addplugins(DefaultPlugins) .addstartup_system(setup.system()) .run(); }
fn setup(
commands: &mut Commands,
mut materials: ResMut
commands.spawn(Camera2dBundle::default()).spawn(primitive(
material.clone(),
&mut meshes,
ShapeType::Circle(60.0),
TessellationMode::Fill(&FillOptions::default()),
Vec3::new(0.0, 0.0, 0.0).into(),
));
} ```
Don't forget to check out the examples to learn more!