//! This example demonstrates Bevy's immediate mode drawing API intended for visual debugging. use std::f32::consts::{PI, TAU}; use bevy::{color::palettes::css::*, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .init_gizmo_group::() .add_systems(Startup, setup) .add_systems(Update, (draw_example_collection, update_config)) .run(); } // We can create our own gizmo config group! #[derive(Default, Reflect, GizmoConfigGroup)] struct MyRoundGizmos {} fn setup(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2dBundle::default()); // text commands.spawn( TextBundle::from_section( "Hold 'Left' or 'Right' to change the line width of straight gizmos\n\ Hold 'Up' or 'Down' to change the line width of round gizmos\n\ Press '1' / '2' to toggle the visibility of straight / round gizmos\n\ Press 'U' / 'I' to cycle through line styles\n\ Press 'J' / 'K' to cycle through line joins", TextStyle { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 20., color: Color::WHITE, }, ) .with_style(Style { position_type: PositionType::Absolute, top: Val::Px(12.), left: Val::Px(12.), ..default() }), ); } fn draw_example_collection( mut gizmos: Gizmos, mut my_gizmos: Gizmos, time: Res