From 6108f140b6c5ccd98840de43b513ea01df6646db Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sat, 22 Mar 2025 20:33:25 -0400 Subject: [PATCH] Remove text and more unnecessary dependencies --- .../install-system-libraries/action.yml | 2 +- Cargo.lock | 123 ++---------------- Cargo.toml | 5 - src/main.rs | 85 +----------- 4 files changed, 12 insertions(+), 203 deletions(-) diff --git a/.forgejo/actions/install-system-libraries/action.yml b/.forgejo/actions/install-system-libraries/action.yml index 32dea86..592d03f 100644 --- a/.forgejo/actions/install-system-libraries/action.yml +++ b/.forgejo/actions/install-system-libraries/action.yml @@ -8,4 +8,4 @@ runs: shell: bash run: | sudo apt-get update - sudo apt-get -y install libasound2-dev libudev-dev libwayland-dev + sudo apt-get -y install libwayland-dev diff --git a/Cargo.lock b/Cargo.lock index 2764750..1bf7c0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,8 +60,8 @@ dependencies = [ "hashbrown 0.15.2", "paste", "static_assertions", - "windows 0.58.0", - "windows-core 0.58.0", + "windows", + "windows-core", ] [[package]] @@ -489,7 +489,6 @@ dependencies = [ "bevy_time", "bevy_utils", "const-fnv1a-hash", - "sysinfo", ] [[package]] @@ -671,7 +670,6 @@ dependencies = [ "bevy_render", "bevy_scene", "bevy_sprite", - "bevy_state", "bevy_tasks", "bevy_text", "bevy_time", @@ -929,32 +927,6 @@ dependencies = [ "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]] name = "bevy_tasks" version = "0.15.3" @@ -1991,7 +1963,7 @@ dependencies = [ "log", "presser", "thiserror", - "windows 0.58.0", + "windows", ] [[package]] @@ -2441,15 +2413,6 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" -[[package]] -name = "ntapi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" -dependencies = [ - "winapi", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -3569,19 +3532,6 @@ dependencies = [ "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]] name = "taffy" version = "0.5.2" @@ -4205,8 +4155,8 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu-types", - "windows 0.58.0", - "windows-core 0.58.0", + "windows", + "windows-core", ] [[package]] @@ -4261,35 +4211,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "windows" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "windows-core 0.58.0", - "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-core", "windows-targets 0.52.6", ] @@ -4299,24 +4227,13 @@ version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", + "windows-implement", + "windows-interface", + "windows-result", "windows-strings", "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]] name = "windows-implement" version = "0.58.0" @@ -4328,17 +4245,6 @@ dependencies = [ "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]] name = "windows-interface" version = "0.58.0" @@ -4350,15 +4256,6 @@ dependencies = [ "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]] name = "windows-result" version = "0.2.0" @@ -4374,7 +4271,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result 0.2.0", + "windows-result", "windows-targets 0.52.6", ] diff --git a/Cargo.toml b/Cargo.toml index 96b2319..4a3b943 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,16 +22,11 @@ bevy = { version = "0.15.3", default-features = false, features = [ "bevy_color", "bevy_core_pipeline", "bevy_render", - "bevy_scene", - "bevy_state", - "bevy_text", "bevy_ui", "bevy_window", "bevy_winit", - "default_font", "dynamic_linking", "multi_threaded", - "sysinfo_plugin", "wayland", ] } log = { version = "*", features = [ diff --git a/src/main.rs b/src/main.rs index b7264d2..2f15d49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,12 +49,11 @@ fn main() { app.insert_resource(Time::from_hz(10.0)); // 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( Update, ( change_timestep, - update_timestep_text, // Reset the scene when the 'R' key is pressed. reset_balls.run_if(input_pressed(KeyCode::KeyR)), ), @@ -140,79 +139,6 @@ fn reset_balls(mut commands: Commands, query: Query>) { 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. fn change_timestep(mut time: ResMut>, keyboard_input: Res>) { if keyboard_input.pressed(KeyCode::ArrowUp) { @@ -224,12 +150,3 @@ fn change_timestep(mut time: ResMut>, keyboard_input: Res>, - time: Res>, -) { - let timestep = time.timestep().as_secs_f32().recip(); - text.0 = format!("{timestep:.2}"); -}