Remove text and more unnecessary dependencies
This commit is contained in:
parent
a1bfe669e3
commit
6108f140b6
4 changed files with 12 additions and 203 deletions
|
@ -8,4 +8,4 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install libasound2-dev libudev-dev libwayland-dev
|
sudo apt-get -y install libwayland-dev
|
||||||
|
|
123
Cargo.lock
generated
123
Cargo.lock
generated
|
@ -60,8 +60,8 @@ dependencies = [
|
||||||
"hashbrown 0.15.2",
|
"hashbrown 0.15.2",
|
||||||
"paste",
|
"paste",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"windows 0.58.0",
|
"windows",
|
||||||
"windows-core 0.58.0",
|
"windows-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -489,7 +489,6 @@ dependencies = [
|
||||||
"bevy_time",
|
"bevy_time",
|
||||||
"bevy_utils",
|
"bevy_utils",
|
||||||
"const-fnv1a-hash",
|
"const-fnv1a-hash",
|
||||||
"sysinfo",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -671,7 +670,6 @@ dependencies = [
|
||||||
"bevy_render",
|
"bevy_render",
|
||||||
"bevy_scene",
|
"bevy_scene",
|
||||||
"bevy_sprite",
|
"bevy_sprite",
|
||||||
"bevy_state",
|
|
||||||
"bevy_tasks",
|
"bevy_tasks",
|
||||||
"bevy_text",
|
"bevy_text",
|
||||||
"bevy_time",
|
"bevy_time",
|
||||||
|
@ -929,32 +927,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bevy_state"
|
|
||||||
version = "0.15.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "243a72266f81452412f7a3859e5d11473952a25767dc29c8d285660330f007ba"
|
|
||||||
dependencies = [
|
|
||||||
"bevy_app",
|
|
||||||
"bevy_ecs",
|
|
||||||
"bevy_hierarchy",
|
|
||||||
"bevy_reflect",
|
|
||||||
"bevy_state_macros",
|
|
||||||
"bevy_utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bevy_state_macros"
|
|
||||||
version = "0.15.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "022eb069dfd64090fd92ba4a7f235383e49aa1c0f4320dab4999b23f67843b36"
|
|
||||||
dependencies = [
|
|
||||||
"bevy_macro_utils",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_tasks"
|
name = "bevy_tasks"
|
||||||
version = "0.15.3"
|
version = "0.15.3"
|
||||||
|
@ -1991,7 +1963,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"presser",
|
"presser",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"windows 0.58.0",
|
"windows",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2441,15 +2413,6 @@ version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51"
|
checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ntapi"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.46.0"
|
version = "0.46.0"
|
||||||
|
@ -3569,19 +3532,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sysinfo"
|
|
||||||
version = "0.32.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4c33cd241af0f2e9e3b5c32163b873b29956890b5342e6745b917ce9d490f4af"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys",
|
|
||||||
"libc",
|
|
||||||
"memchr",
|
|
||||||
"ntapi",
|
|
||||||
"windows 0.57.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "taffy"
|
name = "taffy"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -4205,8 +4155,8 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
"windows 0.58.0",
|
"windows",
|
||||||
"windows-core 0.58.0",
|
"windows-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4261,35 +4211,13 @@ version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows"
|
|
||||||
version = "0.57.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
|
||||||
dependencies = [
|
|
||||||
"windows-core 0.57.0",
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.58.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core 0.58.0",
|
"windows-core",
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-core"
|
|
||||||
version = "0.57.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
|
||||||
dependencies = [
|
|
||||||
"windows-implement 0.57.0",
|
|
||||||
"windows-interface 0.57.0",
|
|
||||||
"windows-result 0.1.2",
|
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4299,24 +4227,13 @@ version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement 0.58.0",
|
"windows-implement",
|
||||||
"windows-interface 0.58.0",
|
"windows-interface",
|
||||||
"windows-result 0.2.0",
|
"windows-result",
|
||||||
"windows-strings",
|
"windows-strings",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-implement"
|
|
||||||
version = "0.57.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-implement"
|
name = "windows-implement"
|
||||||
version = "0.58.0"
|
version = "0.58.0"
|
||||||
|
@ -4328,17 +4245,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-interface"
|
|
||||||
version = "0.57.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-interface"
|
name = "windows-interface"
|
||||||
version = "0.58.0"
|
version = "0.58.0"
|
||||||
|
@ -4350,15 +4256,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-result"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-result"
|
name = "windows-result"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -4374,7 +4271,7 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-result 0.2.0",
|
"windows-result",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,11 @@ bevy = { version = "0.15.3", default-features = false, features = [
|
||||||
"bevy_color",
|
"bevy_color",
|
||||||
"bevy_core_pipeline",
|
"bevy_core_pipeline",
|
||||||
"bevy_render",
|
"bevy_render",
|
||||||
"bevy_scene",
|
|
||||||
"bevy_state",
|
|
||||||
"bevy_text",
|
|
||||||
"bevy_ui",
|
"bevy_ui",
|
||||||
"bevy_window",
|
"bevy_window",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
"default_font",
|
|
||||||
"dynamic_linking",
|
"dynamic_linking",
|
||||||
"multi_threaded",
|
"multi_threaded",
|
||||||
"sysinfo_plugin",
|
|
||||||
"wayland",
|
"wayland",
|
||||||
] }
|
] }
|
||||||
log = { version = "*", features = [
|
log = { version = "*", features = [
|
||||||
|
|
85
src/main.rs
85
src/main.rs
|
@ -49,12 +49,11 @@ fn main() {
|
||||||
app.insert_resource(Time::from_hz(10.0));
|
app.insert_resource(Time::from_hz(10.0));
|
||||||
|
|
||||||
// Setup the scene and UI, and update text in `Update`.
|
// Setup the scene and UI, and update text in `Update`.
|
||||||
app.add_systems(Startup, (setup_scene, setup_balls, setup_text))
|
app.add_systems(Startup, (setup_scene, setup_balls))
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(
|
(
|
||||||
change_timestep,
|
change_timestep,
|
||||||
update_timestep_text,
|
|
||||||
// Reset the scene when the 'R' key is pressed.
|
// Reset the scene when the 'R' key is pressed.
|
||||||
reset_balls.run_if(input_pressed(KeyCode::KeyR)),
|
reset_balls.run_if(input_pressed(KeyCode::KeyR)),
|
||||||
),
|
),
|
||||||
|
@ -140,79 +139,6 @@ fn reset_balls(mut commands: Commands, query: Query<Entity, With<Ball>>) {
|
||||||
commands.run_system_cached(setup_balls);
|
commands.run_system_cached(setup_balls);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component)]
|
|
||||||
struct TimestepText;
|
|
||||||
|
|
||||||
fn setup_text(mut commands: Commands) {
|
|
||||||
let font = TextFont {
|
|
||||||
font_size: 20.0,
|
|
||||||
..default()
|
|
||||||
};
|
|
||||||
|
|
||||||
commands
|
|
||||||
.spawn((
|
|
||||||
Text::new("Fixed Hz: "),
|
|
||||||
TextColor::from(WHITE),
|
|
||||||
font.clone(),
|
|
||||||
Node {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(10.0),
|
|
||||||
left: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
))
|
|
||||||
.with_child((TimestepText, TextSpan::default()));
|
|
||||||
|
|
||||||
commands.spawn((
|
|
||||||
Text::new("Change Timestep With Up/Down Arrow\nPress R to reset"),
|
|
||||||
TextColor::from(WHITE),
|
|
||||||
TextLayout::new_with_justify(JustifyText::Right),
|
|
||||||
font.clone(),
|
|
||||||
Node {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(10.0),
|
|
||||||
right: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
));
|
|
||||||
|
|
||||||
commands.spawn((
|
|
||||||
Text::new("Interpolation"),
|
|
||||||
TextColor::from(CYAN_400),
|
|
||||||
font.clone(),
|
|
||||||
Node {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(50.0),
|
|
||||||
left: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
));
|
|
||||||
|
|
||||||
commands.spawn((
|
|
||||||
Text::new("Extrapolation"),
|
|
||||||
TextColor::from(LIME_400),
|
|
||||||
font.clone(),
|
|
||||||
Node {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(75.0),
|
|
||||||
left: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
));
|
|
||||||
|
|
||||||
commands.spawn((
|
|
||||||
Text::new("No Interpolation"),
|
|
||||||
TextColor::from(RED_400),
|
|
||||||
font.clone(),
|
|
||||||
Node {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(100.0),
|
|
||||||
left: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Changes the timestep of the simulation when the up or down arrow keys are pressed.
|
/// Changes the timestep of the simulation when the up or down arrow keys are pressed.
|
||||||
fn change_timestep(mut time: ResMut<Time<Fixed>>, keyboard_input: Res<ButtonInput<KeyCode>>) {
|
fn change_timestep(mut time: ResMut<Time<Fixed>>, keyboard_input: Res<ButtonInput<KeyCode>>) {
|
||||||
if keyboard_input.pressed(KeyCode::ArrowUp) {
|
if keyboard_input.pressed(KeyCode::ArrowUp) {
|
||||||
|
@ -224,12 +150,3 @@ fn change_timestep(mut time: ResMut<Time<Fixed>>, keyboard_input: Res<ButtonInpu
|
||||||
time.set_timestep_seconds(new_timestep);
|
time.set_timestep_seconds(new_timestep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Updates the text with the current timestep.
|
|
||||||
fn update_timestep_text(
|
|
||||||
mut text: Single<&mut TextSpan, With<TimestepText>>,
|
|
||||||
time: Res<Time<Fixed>>,
|
|
||||||
) {
|
|
||||||
let timestep = time.timestep().as_secs_f32().recip();
|
|
||||||
text.0 = format!("{timestep:.2}");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue