Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
cargo fmt --all
  • Loading branch information
foxzool committed Nov 1, 2024
1 parent 1d83e74 commit 6af0484
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 23 deletions.
1 change: 0 additions & 1 deletion examples/2d/2d_viewport_to_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ fn draw_cursor(
) {
let (camera, camera_transform) = *camera_query;


let Some(cursor_position) = window.cursor_position() else {
return;
};
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/pbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ fn environment_map_load_finish(
.load_state(&environment_map.diffuse_map)
.is_loaded()
&& asset_server
.load_state(&environment_map.specular_map)
.is_loaded()
.load_state(&environment_map.specular_map)
.is_loaded()
{
commands.entity(*label_entity).despawn();
}
Expand Down
6 changes: 1 addition & 5 deletions examples/asset/alter_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,8 @@ fn alter_mesh(
left_shape: Single<&Mesh3d, With<Left>>,
mut meshes: ResMut<Assets<Mesh>>,
) {
// It's convenient to retrieve the asset handle stored with the shape on the left. However,
// we could just as easily have retained this in a resource or a dedicated component.
let handle = *left_shape;

// Obtain a mutable reference to the Mesh asset.
let Some(mesh) = meshes.get_mut(handle) else {
let Some(mesh) = meshes.get_mut(left_shape) else {
return;
};

Expand Down
6 changes: 1 addition & 5 deletions examples/asset/alter_sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ fn alter_handle(
}

fn alter_asset(mut images: ResMut<Assets<Image>>, left_bird: Single<&Sprite, With<Left>>) {
// It's convenient to retrieve the asset handle stored with the bird on the left. However,
// we could just as easily have retained this in a resource or a dedicated component.
let sprite = *left_bird;

// Obtain a mutable reference to the Image asset.
let Some(image) = images.get_mut(&sprite.image) else {
let Some(image) = images.get_mut(&left_bird.image) else {
return;
};

Expand Down
10 changes: 2 additions & 8 deletions examples/audio/audio_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@ fn update_speed(sink: Single<&AudioSink, With<MyMusic>>, time: Res<Time>) {
sink.set_speed((ops::sin(time.elapsed_secs() / 5.0) + 1.0).max(0.1));
}

fn pause(
keyboard_input: Res<ButtonInput<KeyCode>>,
sink: Single<&AudioSink, With<MyMusic>>,
) {
fn pause(keyboard_input: Res<ButtonInput<KeyCode>>, sink: Single<&AudioSink, With<MyMusic>>) {
if keyboard_input.just_pressed(KeyCode::Space) {
sink.toggle();
}
}

fn volume(
keyboard_input: Res<ButtonInput<KeyCode>>,
sink: Single<&AudioSink, With<MyMusic>>,
) {
fn volume(keyboard_input: Res<ButtonInput<KeyCode>>, sink: Single<&AudioSink, With<MyMusic>>) {
if keyboard_input.just_pressed(KeyCode::Equal) {
sink.set_volume(sink.volume() + 0.1);
} else if keyboard_input.just_pressed(KeyCode::Minus) {
Expand Down
3 changes: 1 addition & 2 deletions examples/helpers/camera_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ fn run_camera_controller(
.clamp(-PI / 2., PI / 2.);
controller.yaw -=
accumulated_mouse_motion.delta.x * RADIANS_PER_DOT * controller.sensitivity;
transform.rotation =
Quat::from_euler(EulerRot::ZYX, 0.0, controller.yaw, controller.pitch);
transform.rotation = Quat::from_euler(EulerRot::ZYX, 0.0, controller.yaw, controller.pitch);
}
}

0 comments on commit 6af0484

Please sign in to comment.