From eb506556713e7054c4512735f02f6b9006fe8499 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sun, 27 Jul 2025 12:57:56 -0500 Subject: [PATCH] autoformat --- src/lib.rs | 48 +++++++++++++++++++-------------------- src/preparation_widget.rs | 16 +++++++++---- src/title_screen.rs | 19 +++++++--------- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bd92e97..688df31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,30 +14,30 @@ pub struct AsteroidPlugin; impl Plugin for AsteroidPlugin { fn build(&self, app: &mut App) { - app.add_plugins((title_screen::GameMenuPlugin, preparation_widget::preparation_widget_plugin)) - .insert_resource(ClearColor(BACKGROUND_COLOR)) - .insert_resource(WorldSize { - width: WINDOW_SIZE.x, - height: WINDOW_SIZE.y, - }) - .insert_resource(Lives(3)) - .register_type::() - .insert_resource(Score(0)) - .add_systems(Startup, spawn_camera) - .add_systems( - OnEnter(GameState::Playing), - (spawn_player, spawn_ui), - ) - .add_systems( - FixedUpdate, - (input_ship_thruster, input_ship_rotation, wrap_entities) - .run_if(in_state(GameState::Playing)), - ) - .add_systems( - FixedPostUpdate, - (integrate_velocity, update_positions, apply_rotation_to_mesh) - .run_if(in_state(GameState::Playing)), - ); + app.add_plugins(( + title_screen::GameMenuPlugin, + preparation_widget::preparation_widget_plugin, + )) + .insert_resource(ClearColor(BACKGROUND_COLOR)) + .insert_resource(WorldSize { + width: WINDOW_SIZE.x, + height: WINDOW_SIZE.y, + }) + .insert_resource(Lives(3)) + .register_type::() + .insert_resource(Score(0)) + .add_systems(Startup, spawn_camera) + .add_systems(OnEnter(GameState::Playing), (spawn_player, spawn_ui)) + .add_systems( + FixedUpdate, + (input_ship_thruster, input_ship_rotation, wrap_entities) + .run_if(in_state(GameState::Playing)), + ) + .add_systems( + FixedPostUpdate, + (integrate_velocity, update_positions, apply_rotation_to_mesh) + .run_if(in_state(GameState::Playing)), + ); app.insert_state(GameState::TitleScreen); } } diff --git a/src/preparation_widget.rs b/src/preparation_widget.rs index ac0b3a2..a29a321 100644 --- a/src/preparation_widget.rs +++ b/src/preparation_widget.rs @@ -1,11 +1,17 @@ -use bevy::prelude::*; +use bevy::{ + color::palettes::css::{BLACK, GREEN, LIGHT_BLUE, RED}, + prelude::*, +}; use crate::GameState; pub fn preparation_widget_plugin(app: &mut App) { - app.add_systems(OnEnter(GameState::GetReady), spawn_get_ready) - .add_systems(OnExit(GameState::GetReady), despawn_get_ready) - .add_systems(Update, (animate_get_ready_widget).run_if(in_state(GameState::GetReady))); + app.add_systems(OnEnter(GameState::GetReady), spawn_get_ready) + .add_systems(OnExit(GameState::GetReady), despawn_get_ready) + .add_systems( + Update, + (animate_get_ready_widget).run_if(in_state(GameState::GetReady)), + ); } /// Marker component for things on the get-ready indicator @@ -65,6 +71,6 @@ fn despawn_get_ready(mut commands: Commands, to_despawn: Query>, -) { +fn despawn_menu(mut commands: Commands, to_despawn: Query>) { for entity in &to_despawn { commands.entity(entity).despawn(); } } -fn handle_spacebar( - input: Res>, - mut game_state: ResMut>, -) { +fn handle_spacebar(input: Res>, mut game_state: ResMut>) { if input.just_pressed(KeyCode::Space) { - game_state.set(GameState::Playing); + game_state.set(GameState::GetReady); } -} \ No newline at end of file +}