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. - Canvas
Plugin - A Bevy
Plugin
that gives the ability to directly draw 2D shapes from a system. - Fill
Options - Parameters for the fill tessellator.
- Path
- A simple path data structure.
- Path
Builder - Builder for a Lyon
Path
structure. - Stroke
Options - Parameters for the tessellator.
Enums§
- Draw
Mode - Determines how a shape is tessellated (i.e. transformed from a parametric representation to a triangle mesh).
- Fill
Rule - 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.
- Line
Join - 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
.