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
Shape2dPlugin::default(),
))
.add_systems(Startup, setup)
.add_systems(Update, draw)
.run();
}
fn setup(mut commands: Commands) {
// Spawn the camera
commands.spawn(Camera2d);
}
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.