From c7a3e272b6387a38c0e8bef721ea3bccd9feff95 Mon Sep 17 00:00:00 2001 From: ActuallyHappening <105958073+ActuallyHappening@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:51:55 +1000 Subject: [PATCH 1/2] add: bevy_minimal.rs example --- crates/transform-gizmo-bevy/Cargo.toml | 3 ++ .../examples/bevy_minimal.rs | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 crates/transform-gizmo-bevy/examples/bevy_minimal.rs diff --git a/crates/transform-gizmo-bevy/Cargo.toml b/crates/transform-gizmo-bevy/Cargo.toml index aaf4052..9bdfad5 100644 --- a/crates/transform-gizmo-bevy/Cargo.toml +++ b/crates/transform-gizmo-bevy/Cargo.toml @@ -37,5 +37,8 @@ bevy_log.workspace = true bevy_window.workspace = true bevy_transform.workspace = true +[dev-dependencies] +bevy = "0.13" + [lints] workspace = true \ No newline at end of file diff --git a/crates/transform-gizmo-bevy/examples/bevy_minimal.rs b/crates/transform-gizmo-bevy/examples/bevy_minimal.rs new file mode 100644 index 0000000..f6d2872 --- /dev/null +++ b/crates/transform-gizmo-bevy/examples/bevy_minimal.rs @@ -0,0 +1,46 @@ +use bevy::prelude::*; +use transform_gizmo_bevy::*; + +fn main() { + App::new() + .add_plugins((DefaultPlugins, TransformGizmoPlugin)) + .add_systems(Startup, setup) + .run(); +} + +fn setup( + mut commands: Commands, + mut materials: ResMut>, + mut meshes: ResMut>, +) { + // camera + commands.spawn(( + Camera3dBundle { + transform: Transform::from_translation(Vec3::new(1.0, 3.0, -5.0)) + .looking_at(Vec3::ZERO, Vec3::Y), + ..default() + }, + GizmoCamera, + )); + + // cube + commands.spawn(( + PbrBundle { + mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), + material: materials.add(Color::GREEN), + transform: Transform::from_translation(Vec3::new(0.0, 0.0, 0.0)), + ..default() + }, + GizmoTarget::default(), + )); + + // light + commands.spawn(PointLightBundle { + point_light: PointLight { + shadows_enabled: true, + ..default() + }, + transform: Transform::from_xyz(4.0, 8.0, 4.0), + ..default() + }); +} From 949874a9e440eae3d2078decc72d4abf9cb95a43 Mon Sep 17 00:00:00 2001 From: ActuallyHappening <105958073+ActuallyHappening@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:56:30 +1000 Subject: [PATCH 2/2] doc: Adds top level docs to bevy_minimal.rs --- crates/transform-gizmo-bevy/examples/bevy_minimal.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/transform-gizmo-bevy/examples/bevy_minimal.rs b/crates/transform-gizmo-bevy/examples/bevy_minimal.rs index f6d2872..24e287b 100644 --- a/crates/transform-gizmo-bevy/examples/bevy_minimal.rs +++ b/crates/transform-gizmo-bevy/examples/bevy_minimal.rs @@ -1,3 +1,6 @@ +//! A very simple example +//! See the project root's `examples` directory for more examples + use bevy::prelude::*; use transform_gizmo_bevy::*;