Crate bevy_canvas

Source
Expand description

§Unofficial Bevy canvas API

This crate allows Bevy users to arbitrarily draw 2D shapes without spawning any entity. You will need to spawn a 2D camera.

The main goal of this project is to help users draw any geometric shape in the most ergonomical possible way, without the need to spawn entities, unlike bevy_prototype_lyon.

§Setup

Don’t forget to add the plugin and a 2d camera. Here’s an example:

use bevy::prelude::*;
use bevy_canvas::CanvasPlugin;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(bevy_canvas::CanvasPlugin)
        .add_startup_system(setup.system());
}

fn setup(mut commands: Commands) {
    commands.spawn_bundle(OrthographicCameraBundle::new_2d());
}

§Usage

For the common usage guide, see the plugin documentation.

Modules§

common_shapes
A convenient collection of shapes.

Structs§

Canvas
A Bevy Resource that exposes an immediate mode 2D rendering API.
CanvasPlugin
A Bevy Plugin that gives the ability to directly draw 2D shapes from a system.
FillOptions
Parameters for the fill tessellator.
Path
A simple path data structure.
PathBuilder
Builder for a Lyon Path structure.
StrokeOptions
Parameters for the tessellator.

Enums§

DrawMode
Determines how a shape is tessellated (i.e. transformed from a parametric representation to a triangle mesh).
FillRule
The fill rule defines how to determine what is inside and what is outside of the shape.
LineCap
Line cap as defined by the SVG specification.
LineJoin
Line join as defined by the SVG specification.
Orientation
Vertical or Horizontal.

Traits§

Geometry
Determines how a struct can be transformed into a Lyon Path.