updating the examples
This commit is contained in:
parent
8a56176ceb
commit
9ab58e39e7
@ -1,17 +1,14 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
[package]
|
||||
name = "turtle-example"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
members = [
|
||||
"turtle-lib",
|
||||
"turtle-example",
|
||||
]
|
||||
|
||||
|
||||
# Enable a small amount of optimization in debug mode
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = { workspace = true, features = ["wayland"] }
|
||||
bevy_prototype_lyon = { workspace = true }
|
||||
num-traits = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
turtle-lib = { path = "../turtle-lib" }
|
||||
|
||||
@ -9,11 +9,11 @@ struct Egon {}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugin(TurtlePlugin)
|
||||
.add_startup_system(setup)
|
||||
//.add_system(plan)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugins(TurtlePlugin)
|
||||
.add_systems(Startup, setup)
|
||||
//.add_systems(Update, plan)
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
@ -21,7 +21,9 @@ fn setup(mut commands: Commands) {
|
||||
let mut turtle = get_a_turtle();
|
||||
turtle.set_speed(1);
|
||||
|
||||
let mt = turtle.pen_up();
|
||||
// NOTE: pen_up() consumes self, which is why this example is incomplete
|
||||
// TODO: Fix the builder API to work with the deref pattern
|
||||
// let mt = turtle.pen_up();
|
||||
|
||||
//commands.spawn((turtle, Egon {}));
|
||||
commands.spawn((turtle, Egon {}));
|
||||
}
|
||||
|
||||
@ -10,11 +10,11 @@ struct Egon {}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugin(TurtlePlugin)
|
||||
.add_startup_system(setup)
|
||||
//.add_system(plan)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugins(TurtlePlugin)
|
||||
.add_systems(Startup, setup)
|
||||
//.add_systems(Update, plan)
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ fn setup(mut commands: Commands) {
|
||||
let mut turtle = get_a_turtle();
|
||||
turtle.set_speed(1);
|
||||
for _x in 0..3 {
|
||||
koch(3, &mut turtle);
|
||||
koch(4, &mut turtle);
|
||||
turtle.right(120);
|
||||
}
|
||||
commands.spawn((turtle, Egon {}));
|
||||
|
||||
@ -10,11 +10,11 @@ struct Egon {}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugin(TurtlePlugin)
|
||||
.add_startup_system(setup)
|
||||
//.add_system(plan)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugins(TurtlePlugin)
|
||||
.add_systems(Startup, setup)
|
||||
//.add_systems(Update, plan)
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
|
||||
@ -10,17 +10,17 @@ struct Egon {}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugin(TurtlePlugin)
|
||||
.add_startup_system(setup)
|
||||
//.add_system(plan)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugins(TurtlePlugin)
|
||||
.add_systems(Startup, setup)
|
||||
//.add_systems(Update, plan)
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {
|
||||
let mut turtle = get_a_turtle();
|
||||
turtle.set_speed(500);
|
||||
turtle.set_speed(1000);
|
||||
stern(&mut turtle);
|
||||
|
||||
commands.spawn((turtle, Egon {}));
|
||||
|
||||
@ -1,24 +1,25 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use bevy_inspector_egui::prelude::*;
|
||||
use bevy_tweening::{lens::*, *};
|
||||
// Note: bevy_inspector_egui and bevy_tweening are not yet fully compatible with Bevy 0.17
|
||||
// This example is disabled until they are updated
|
||||
// use bevy_inspector_egui::prelude::*;
|
||||
// use bevy_tweening::{lens::*, *};
|
||||
|
||||
fn main() {
|
||||
App::default()
|
||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||
window: WindowDescriptor {
|
||||
primary_window: Some(Window {
|
||||
title: "TransformPositionLens".to_string(),
|
||||
width: 1400.,
|
||||
height: 600.,
|
||||
resolution: (1400, 600).into(),
|
||||
present_mode: bevy::window::PresentMode::Fifo, // vsync
|
||||
..default()
|
||||
},
|
||||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_system(bevy::window::close_on_esc)
|
||||
.add_plugin(TweeningPlugin)
|
||||
.add_startup_system(setup)
|
||||
.add_system(update_animation_speed)
|
||||
// .add_systems(Update, bevy::window::close_on_esc)
|
||||
// .add_plugins(TweeningPlugin)
|
||||
.add_systems(Startup, setup)
|
||||
// .add_systems(Update, update_animation_speed)
|
||||
.register_type::<Options>()
|
||||
.run();
|
||||
}
|
||||
@ -35,8 +36,12 @@ impl Default for Options {
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {
|
||||
commands.spawn(Camera2dBundle::default());
|
||||
commands.spawn(Camera2d);
|
||||
|
||||
// NOTE: This example is disabled because bevy_tweening is not yet compatible with Bevy 0.17
|
||||
// Once bevy_tweening is updated, uncomment the code below
|
||||
|
||||
/*
|
||||
let size = 25.;
|
||||
|
||||
let spacing = 1.5;
|
||||
@ -98,22 +103,22 @@ fn setup(mut commands: Commands) {
|
||||
);
|
||||
|
||||
commands.spawn((
|
||||
SpriteBundle {
|
||||
sprite: Sprite {
|
||||
color: Color::RED,
|
||||
Sprite {
|
||||
color: Color::srgb(1.0, 0.0, 0.0),
|
||||
custom_size: Some(Vec2::new(size, size)),
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
},
|
||||
Animator::new(tween),
|
||||
));
|
||||
|
||||
x += size * spacing;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
fn update_animation_speed(options: Res<Options>, mut animators: Query<&mut Animator<Transform>>) {
|
||||
fn update_animation_speed(_options: Res<Options> /*, mut animators: Query<&mut Animator<Transform>>*/) {
|
||||
// NOTE: This function is disabled because bevy_tweening is not yet compatible with Bevy 0.17
|
||||
/*
|
||||
if !options.is_changed() {
|
||||
return;
|
||||
}
|
||||
@ -121,4 +126,5 @@ fn update_animation_speed(options: Res<Options>, mut animators: Query<&mut Anima
|
||||
for mut animator in animators.iter_mut() {
|
||||
animator.set_speed(options.speed);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@ -1,26 +1,25 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_inspector_egui::Inspectable;
|
||||
use turtle_lib::builders::{CurvedMovement, DirectionalMovement, Turnable};
|
||||
use turtle_lib::{get_a_turtle, TurtlePlugin};
|
||||
|
||||
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
|
||||
|
||||
#[derive(Component, Inspectable)]
|
||||
#[derive(Component, Reflect)]
|
||||
struct Egon {}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugin(TurtlePlugin)
|
||||
.add_startup_system(setup)
|
||||
.add_plugins(TurtlePlugin)
|
||||
.add_systems(Startup, setup)
|
||||
//.add_system(plan)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugins(LogDiagnosticsPlugin::default())
|
||||
.add_plugins(FrameTimeDiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {
|
||||
let mut turtle = get_a_turtle();
|
||||
turtle.set_speed(1000);
|
||||
turtle.set_speed(0);
|
||||
turtle.circle(50, 90);
|
||||
turtle.circle_right(50, 180);
|
||||
turtle.circle(50, 90);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user