Crate bevy_vector_shapes
source ·Expand description
bevy_vector_shapes
is a library for easily and ergonomically creating instanced vector shapes in Bevy.
§Usage
See the the examples for more details on all supported features.
use bevy::prelude::*;
// Import commonly used items
use bevy_vector_shapes::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// Add the shape plugin:
// - Shape2dPlugin for 2D cameras
// - ShapePlugin for both 3D and 2D cameras
.add_plugins(Shape2dPlugin::default())
.add_startup_system(setup)
.add_system(draw)
.run();
}
fn setup(mut commands: Commands) {
// Spawn the camera
commands.spawn(Camera2dBundle::default());
}
fn draw(mut painter: ShapePainter) {
// Draw a circle
painter.circle(100.0);
}
Modules§
use bevy_vector_shapes::prelude::*
to import commonly used items.- Rendering specific traits and structs.
- Components and Enums used to define shape types.
Structs§
- Resource that represents the default shape config to be used by
ShapePainter
andShapeCommands
APIs. - Plugin that contains all necessary functionality to draw shapes with a 2D camera.
- Plugin that contains all necessary functionality to draw shapes with a 3D or 2D camera.