### 2D Camera Plugin Setup Source: https://context7.com/james-j-obrien/bevy_vector_shapes/llms.txt Minimal plugin setup for 2D rendering with a 2D camera. Ensure Shape2dPlugin is added to your Bevy App. ```rust use bevy::prelude::*; use bevy_vector_shapes::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(Shape2dPlugin::default()) .add_systems(Startup, setup) .add_systems(Update, draw) .run(); } fn setup(mut commands: Commands) { commands.spawn(Camera2d); } fn draw(mut painter: ShapePainter) { painter.circle(100.0); } ``` -------------------------------- ### Basic Bevy App Setup with Shape2dPlugin Source: https://github.com/james-j-obrien/bevy_vector_shapes/blob/main/README.md Set up a Bevy application with the Shape2dPlugin for 2D cameras. This includes initializing the Bevy app, adding the shape plugin, and defining startup and update systems for drawing. ```rust 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_systems(Startup, setup) .add_systems(Update, 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); } ``` -------------------------------- ### 2D and 3D Camera Plugin Setup Source: https://context7.com/james-j-obrien/bevy_vector_shapes/llms.txt Plugin setup for rendering shapes with both 3D and 2D cameras. This includes Shape2dPlugin and adds 3D rendering capabilities. ```rust use bevy::prelude::*; use bevy_vector_shapes::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(ShapePlugin::default()) .add_systems(Startup, setup) .add_systems(Update, draw) .run(); } fn setup(mut commands: Commands) { commands.spawn(( Camera3d::default(), Transform::from_xyz(0., 0., 16.).looking_at(Vec3::ZERO, Vec3::Y), Msaa::Off, )); } fn draw(mut painter: ShapePainter) { painter.circle(1.0); painter.translate(Vec3::X * 3.0); painter.rect(Vec2::new(2.0, 1.5)); } ``` -------------------------------- ### Retained Mode Spawning with ShapeCommands Source: https://context7.com/james-j-obrien/bevy_vector_shapes/llms.txt Spawns shapes as persistent entities using ShapeCommands. These shapes are retained until despawned and can be manipulated via Bevy's ECS. Example includes spawning a circle with child lines. ```rust use bevy::prelude::*; use bevy_vector_shapes::prelude::*; use std::f32::consts::PI; fn spawn_shapes(mut commands: Commands, mut shapes: ShapeCommands) { commands.spawn(( Camera3d::default(), Transform::from_xyz(0., 0., 16.).looking_at(Vec3::ZERO, Vec3::Y), Msaa::Off, )); // Spawn a circle with child lines shapes.circle(1.0).with_children(|parent| { for _ in 0..4 { parent.rotate_z(PI / 2.0); parent.line(Vec3::ZERO, Vec3::Y * 2.0); } }); } // Query and animate retained shapes fn rotate_shapes(time: Res