Remove useless single tuples and trailing commas (#9720)
# Objective Title
This commit is contained in:
parent
e663d45e94
commit
8eb6ccdd87
@ -51,7 +51,7 @@ fn deterministic_rand() -> ChaCha8Rng {
|
|||||||
|
|
||||||
fn setup<T: Component + Default>(entity_count: u32) -> World {
|
fn setup<T: Component + Default>(entity_count: u32) -> World {
|
||||||
let mut world = World::default();
|
let mut world = World::default();
|
||||||
world.spawn_batch((0..entity_count).map(|_| (T::default(),)));
|
world.spawn_batch((0..entity_count).map(|_| T::default()));
|
||||||
black_box(world)
|
black_box(world)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use criterion::*;
|
|||||||
mod iter;
|
mod iter;
|
||||||
mod send;
|
mod send;
|
||||||
|
|
||||||
criterion_group!(event_benches, send, iter,);
|
criterion_group!(event_benches, send, iter);
|
||||||
|
|
||||||
fn send(c: &mut Criterion) {
|
fn send(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("events_send");
|
let mut group = c.benchmark_group("events_send");
|
||||||
|
@ -383,7 +383,7 @@ pub fn query_get(criterion: &mut Criterion) {
|
|||||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||||
let mut world = World::default();
|
let mut world = World::default();
|
||||||
let mut entities: Vec<_> = world
|
let mut entities: Vec<_> = world
|
||||||
.spawn_batch((0..entity_count).map(|_| (Sparse::default(),)))
|
.spawn_batch((0..entity_count).map(|_| Sparse::default()))
|
||||||
.collect();
|
.collect();
|
||||||
entities.shuffle(&mut deterministic_rand());
|
entities.shuffle(&mut deterministic_rand());
|
||||||
let mut query = SystemState::<Query<&Sparse>>::new(&mut world);
|
let mut query = SystemState::<Query<&Sparse>>::new(&mut world);
|
||||||
|
@ -1529,19 +1529,19 @@ mod tests {
|
|||||||
world.spawn((B(1), C));
|
world.spawn((B(1), C));
|
||||||
world.spawn(A(1));
|
world.spawn(A(1));
|
||||||
world.spawn(C);
|
world.spawn(C);
|
||||||
assert_eq!(2, query_min_size![(), (With<A>, Without<B>)],);
|
assert_eq!(2, query_min_size![(), (With<A>, Without<B>)]);
|
||||||
assert_eq!(3, query_min_size![&B, Or<(With<A>, With<C>)>],);
|
assert_eq!(3, query_min_size![&B, Or<(With<A>, With<C>)>]);
|
||||||
assert_eq!(1, query_min_size![&B, (With<A>, With<C>)],);
|
assert_eq!(1, query_min_size![&B, (With<A>, With<C>)]);
|
||||||
assert_eq!(1, query_min_size![(&A, &B), With<C>],);
|
assert_eq!(1, query_min_size![(&A, &B), With<C>]);
|
||||||
assert_eq!(4, query_min_size![&A, ()], "Simple Archetypal");
|
assert_eq!(4, query_min_size![&A, ()], "Simple Archetypal");
|
||||||
assert_eq!(4, query_min_size![Ref<A>, ()],);
|
assert_eq!(4, query_min_size![Ref<A>, ()]);
|
||||||
// All the following should set minimum size to 0, as it's impossible to predict
|
// All the following should set minimum size to 0, as it's impossible to predict
|
||||||
// how many entities the filters will trim.
|
// how many entities the filters will trim.
|
||||||
assert_eq!(0, query_min_size![(), Added<A>], "Simple Added");
|
assert_eq!(0, query_min_size![(), Added<A>], "Simple Added");
|
||||||
assert_eq!(0, query_min_size![(), Changed<A>], "Simple Changed");
|
assert_eq!(0, query_min_size![(), Changed<A>], "Simple Changed");
|
||||||
assert_eq!(0, query_min_size![(&A, &B), Changed<A>],);
|
assert_eq!(0, query_min_size![(&A, &B), Changed<A>]);
|
||||||
assert_eq!(0, query_min_size![&A, (Changed<A>, With<B>)],);
|
assert_eq!(0, query_min_size![&A, (Changed<A>, With<B>)]);
|
||||||
assert_eq!(0, query_min_size![(&A, &B), Or<(Changed<A>, Changed<B>)>],);
|
assert_eq!(0, query_min_size![(&A, &B), Or<(Changed<A>, Changed<B>)>]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -904,7 +904,7 @@ mod tests {
|
|||||||
fn push_and_clear_children_commands() {
|
fn push_and_clear_children_commands() {
|
||||||
let mut world = World::default();
|
let mut world = World::default();
|
||||||
let entities = world
|
let entities = world
|
||||||
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
|
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
|
||||||
.collect::<Vec<Entity>>();
|
.collect::<Vec<Entity>>();
|
||||||
|
|
||||||
let mut queue = CommandQueue::default();
|
let mut queue = CommandQueue::default();
|
||||||
@ -942,7 +942,7 @@ mod tests {
|
|||||||
fn push_and_replace_children_commands() {
|
fn push_and_replace_children_commands() {
|
||||||
let mut world = World::default();
|
let mut world = World::default();
|
||||||
let entities = world
|
let entities = world
|
||||||
.spawn_batch(vec![(C(1),), (C(2),), (C(3),), (C(4),), (C(5),)])
|
.spawn_batch(vec![C(1), C(2), C(3), C(4), C(5)])
|
||||||
.collect::<Vec<Entity>>();
|
.collect::<Vec<Entity>>();
|
||||||
|
|
||||||
let mut queue = CommandQueue::default();
|
let mut queue = CommandQueue::default();
|
||||||
|
@ -1063,7 +1063,7 @@ pub fn prepare_lights(
|
|||||||
.spawn((
|
.spawn((
|
||||||
ShadowView {
|
ShadowView {
|
||||||
depth_texture_view,
|
depth_texture_view,
|
||||||
pass_name: format!("shadow pass spot light {light_index}",),
|
pass_name: format!("shadow pass spot light {light_index}"),
|
||||||
},
|
},
|
||||||
ExtractedView {
|
ExtractedView {
|
||||||
viewport: UVec4::new(
|
viewport: UVec4::new(
|
||||||
|
@ -1078,7 +1078,7 @@ fn get_registration<'a, E: Error>(
|
|||||||
registry: &'a TypeRegistry,
|
registry: &'a TypeRegistry,
|
||||||
) -> Result<&'a TypeRegistration, E> {
|
) -> Result<&'a TypeRegistration, E> {
|
||||||
let registration = registry.get(type_id).ok_or_else(|| {
|
let registration = registry.get(type_id).ok_or_else(|| {
|
||||||
Error::custom(format_args!("no registration found for type `{type_name}`",))
|
Error::custom(format_args!("no registration found for type `{type_name}`"))
|
||||||
})?;
|
})?;
|
||||||
Ok(registration)
|
Ok(registration)
|
||||||
}
|
}
|
||||||
|
@ -1892,7 +1892,7 @@ mod tests {
|
|||||||
let starting_vec4 = Vec4::new(0.4, 0.5, 0.6, 1.0);
|
let starting_vec4 = Vec4::new(0.4, 0.5, 0.6, 1.0);
|
||||||
let starting_color = Color::from(starting_vec4);
|
let starting_color = Color::from(starting_vec4);
|
||||||
|
|
||||||
assert_eq!(starting_vec4, Vec4::from(starting_color),);
|
assert_eq!(starting_vec4, Vec4::from(starting_color));
|
||||||
|
|
||||||
let transformation = Vec4::new(0.5, 0.5, 0.5, 1.0);
|
let transformation = Vec4::new(0.5, 0.5, 0.5, 1.0);
|
||||||
|
|
||||||
@ -1915,7 +1915,7 @@ mod tests {
|
|||||||
let mut mutated_color = starting_color;
|
let mut mutated_color = starting_color;
|
||||||
mutated_color *= transformation;
|
mutated_color *= transformation;
|
||||||
|
|
||||||
assert_eq!(starting_color * transformation, mutated_color,);
|
assert_eq!(starting_color * transformation, mutated_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1931,7 +1931,7 @@ mod tests {
|
|||||||
let mut mutated_color = starting_color;
|
let mut mutated_color = starting_color;
|
||||||
mutated_color *= transformation;
|
mutated_color *= transformation;
|
||||||
|
|
||||||
assert_eq!(starting_color * transformation, mutated_color,);
|
assert_eq!(starting_color * transformation, mutated_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1947,7 +1947,7 @@ mod tests {
|
|||||||
let mut mutated_color = starting_color;
|
let mut mutated_color = starting_color;
|
||||||
mutated_color *= transformation;
|
mutated_color *= transformation;
|
||||||
|
|
||||||
assert_eq!(starting_color * transformation, mutated_color,);
|
assert_eq!(starting_color * transformation, mutated_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1963,7 +1963,7 @@ mod tests {
|
|||||||
let mut mutated_color = starting_color;
|
let mut mutated_color = starting_color;
|
||||||
mutated_color *= transformation;
|
mutated_color *= transformation;
|
||||||
|
|
||||||
assert_eq!(starting_color * transformation, mutated_color,);
|
assert_eq!(starting_color * transformation, mutated_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1979,7 +1979,7 @@ mod tests {
|
|||||||
let mut mutated_color = starting_color;
|
let mut mutated_color = starting_color;
|
||||||
mutated_color *= transformation;
|
mutated_color *= transformation;
|
||||||
|
|
||||||
assert_eq!(starting_color * transformation, mutated_color,);
|
assert_eq!(starting_color * transformation, mutated_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// regression test for https://github.com/bevyengine/bevy/pull/8040
|
// regression test for https://github.com/bevyengine/bevy/pull/8040
|
||||||
|
@ -806,7 +806,7 @@ mod tests {
|
|||||||
.find(|dynamic_entity| dynamic_entity.entity == expected.entity)
|
.find(|dynamic_entity| dynamic_entity.entity == expected.entity)
|
||||||
.unwrap_or_else(|| panic!("missing entity (expected: `{:?}`)", expected.entity));
|
.unwrap_or_else(|| panic!("missing entity (expected: `{:?}`)", expected.entity));
|
||||||
|
|
||||||
assert_eq!(expected.entity, received.entity, "entities did not match",);
|
assert_eq!(expected.entity, received.entity, "entities did not match");
|
||||||
|
|
||||||
for expected in &expected.components {
|
for expected in &expected.components {
|
||||||
let received = received
|
let received = received
|
||||||
|
@ -484,7 +484,7 @@ mod tests {
|
|||||||
assert_eq!(time.raw_delta(), Duration::ZERO);
|
assert_eq!(time.raw_delta(), Duration::ZERO);
|
||||||
assert_eq!(time.raw_delta_seconds(), 0.0);
|
assert_eq!(time.raw_delta_seconds(), 0.0);
|
||||||
assert_eq!(time.raw_delta_seconds_f64(), 0.0);
|
assert_eq!(time.raw_delta_seconds_f64(), 0.0);
|
||||||
assert_eq!(time.elapsed(), first_update_instant - start_instant,);
|
assert_eq!(time.elapsed(), first_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.elapsed_seconds(),
|
time.elapsed_seconds(),
|
||||||
(first_update_instant - start_instant).as_secs_f32(),
|
(first_update_instant - start_instant).as_secs_f32(),
|
||||||
@ -493,7 +493,7 @@ mod tests {
|
|||||||
time.elapsed_seconds_f64(),
|
time.elapsed_seconds_f64(),
|
||||||
(first_update_instant - start_instant).as_secs_f64(),
|
(first_update_instant - start_instant).as_secs_f64(),
|
||||||
);
|
);
|
||||||
assert_eq!(time.raw_elapsed(), first_update_instant - start_instant,);
|
assert_eq!(time.raw_elapsed(), first_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.raw_elapsed_seconds(),
|
time.raw_elapsed_seconds(),
|
||||||
(first_update_instant - start_instant).as_secs_f32(),
|
(first_update_instant - start_instant).as_secs_f32(),
|
||||||
@ -532,7 +532,7 @@ mod tests {
|
|||||||
time.raw_delta_seconds_f64(),
|
time.raw_delta_seconds_f64(),
|
||||||
(second_update_instant - first_update_instant).as_secs_f64(),
|
(second_update_instant - first_update_instant).as_secs_f64(),
|
||||||
);
|
);
|
||||||
assert_eq!(time.elapsed(), second_update_instant - start_instant,);
|
assert_eq!(time.elapsed(), second_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.elapsed_seconds(),
|
time.elapsed_seconds(),
|
||||||
(second_update_instant - start_instant).as_secs_f32(),
|
(second_update_instant - start_instant).as_secs_f32(),
|
||||||
@ -541,7 +541,7 @@ mod tests {
|
|||||||
time.elapsed_seconds_f64(),
|
time.elapsed_seconds_f64(),
|
||||||
(second_update_instant - start_instant).as_secs_f64(),
|
(second_update_instant - start_instant).as_secs_f64(),
|
||||||
);
|
);
|
||||||
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant,);
|
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.raw_elapsed_seconds(),
|
time.raw_elapsed_seconds(),
|
||||||
(second_update_instant - start_instant).as_secs_f32(),
|
(second_update_instant - start_instant).as_secs_f32(),
|
||||||
@ -614,7 +614,7 @@ mod tests {
|
|||||||
time.raw_delta_seconds_f64(),
|
time.raw_delta_seconds_f64(),
|
||||||
(second_update_instant - first_update_instant).as_secs_f64(),
|
(second_update_instant - first_update_instant).as_secs_f64(),
|
||||||
);
|
);
|
||||||
assert_eq!(time.elapsed(), second_update_instant - start_instant,);
|
assert_eq!(time.elapsed(), second_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.elapsed_seconds(),
|
time.elapsed_seconds(),
|
||||||
(second_update_instant - start_instant).as_secs_f32(),
|
(second_update_instant - start_instant).as_secs_f32(),
|
||||||
@ -623,7 +623,7 @@ mod tests {
|
|||||||
time.elapsed_seconds_f64(),
|
time.elapsed_seconds_f64(),
|
||||||
(second_update_instant - start_instant).as_secs_f64(),
|
(second_update_instant - start_instant).as_secs_f64(),
|
||||||
);
|
);
|
||||||
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant,);
|
assert_eq!(time.raw_elapsed(), second_update_instant - start_instant);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
time.raw_elapsed_seconds(),
|
time.raw_elapsed_seconds(),
|
||||||
(second_update_instant - start_instant).as_secs_f32(),
|
(second_update_instant - start_instant).as_secs_f32(),
|
||||||
|
@ -620,7 +620,7 @@ mod tests {
|
|||||||
| (LengthPercentage::Percent(a), LengthPercentage::Percent(b)) =>
|
| (LengthPercentage::Percent(a), LengthPercentage::Percent(b)) =>
|
||||||
(a - b).abs() < 0.0001,
|
(a - b).abs() < 0.0001,
|
||||||
_ => false,
|
_ => false,
|
||||||
},);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,20 +94,22 @@ fn setup_terrain_scene(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_instructions(mut commands: Commands) {
|
fn setup_instructions(mut commands: Commands) {
|
||||||
commands.spawn((TextBundle::from_section(
|
commands.spawn(
|
||||||
"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.",
|
TextBundle::from_section(
|
||||||
TextStyle {
|
"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.",
|
||||||
font_size: 20.0,
|
TextStyle {
|
||||||
color: Color::WHITE,
|
font_size: 20.0,
|
||||||
|
color: Color::WHITE,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.with_style(Style {
|
||||||
|
position_type: PositionType::Absolute,
|
||||||
|
bottom: Val::Px(12.0),
|
||||||
|
left: Val::Px(12.0),
|
||||||
..default()
|
..default()
|
||||||
},
|
}),
|
||||||
)
|
);
|
||||||
.with_style(Style {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
bottom: Val::Px(12.0),
|
|
||||||
left: Val::Px(12.0),
|
|
||||||
..default()
|
|
||||||
}),));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle_system(keycode: Res<Input<KeyCode>>, mut fog: Query<&mut FogSettings>) {
|
fn toggle_system(keycode: Res<Input<KeyCode>>, mut fog: Query<&mut FogSettings>) {
|
||||||
|
@ -40,7 +40,7 @@ fn change_component(time: Res<Time>, mut query: Query<(Entity, &mut MyComponent)
|
|||||||
// Only entities matching the filters will be in the query
|
// Only entities matching the filters will be in the query
|
||||||
fn change_detection(query: Query<(Entity, &MyComponent), Changed<MyComponent>>) {
|
fn change_detection(query: Query<(Entity, &MyComponent), Changed<MyComponent>>) {
|
||||||
for (entity, component) in &query {
|
for (entity, component) in &query {
|
||||||
info!("{:?} changed: {:?}", entity, component,);
|
info!("{:?} changed: {:?}", entity, component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,6 @@ fn print_sprite_count(
|
|||||||
timer.tick(time.delta());
|
timer.tick(time.delta());
|
||||||
|
|
||||||
if timer.just_finished() {
|
if timer.just_finished() {
|
||||||
info!("Sprites: {}", sprites.iter().count(),);
|
info!("Sprites: {}", sprites.iter().count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ fn print_light_count(time: Res<Time>, mut timer: Local<PrintingTimer>, lights: Q
|
|||||||
timer.0.tick(time.delta());
|
timer.0.tick(time.delta());
|
||||||
|
|
||||||
if timer.0.just_finished() {
|
if timer.0.just_finished() {
|
||||||
info!("Lights: {}", lights.iter().len(),);
|
info!("Lights: {}", lights.iter().len());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,6 @@ fn print_sprite_count(time: Res<Time>, mut timer: Local<PrintingTimer>, sprites:
|
|||||||
timer.tick(time.delta());
|
timer.tick(time.delta());
|
||||||
|
|
||||||
if timer.just_finished() {
|
if timer.just_finished() {
|
||||||
info!("Sprites: {}", sprites.iter().count(),);
|
info!("Sprites: {}", sprites.iter().count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
})
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
let id = parent
|
let id = parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
align_items: AlignItems::FlexEnd,
|
align_items: AlignItems::FlexEnd,
|
||||||
justify_content: JustifyContent::FlexEnd,
|
justify_content: JustifyContent::FlexEnd,
|
||||||
@ -205,7 +205,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[0]),
|
background_color: BackgroundColor(palette[0]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent.spawn(NodeBundle {
|
parent.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
@ -217,7 +217,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
});
|
});
|
||||||
|
|
||||||
let id = parent
|
let id = parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
height: Val::Px(400.),
|
height: Val::Px(400.),
|
||||||
align_items: AlignItems::FlexEnd,
|
align_items: AlignItems::FlexEnd,
|
||||||
@ -226,7 +226,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[1]),
|
background_color: BackgroundColor(palette[1]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent.spawn(NodeBundle {
|
parent.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
@ -238,7 +238,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
});
|
});
|
||||||
|
|
||||||
let id = parent
|
let id = parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
height: Val::Px(300.),
|
height: Val::Px(300.),
|
||||||
align_items: AlignItems::FlexEnd,
|
align_items: AlignItems::FlexEnd,
|
||||||
@ -247,7 +247,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[2]),
|
background_color: BackgroundColor(palette[2]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent.spawn(NodeBundle {
|
parent.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
@ -259,7 +259,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
});
|
});
|
||||||
|
|
||||||
let id = parent
|
let id = parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Px(200.),
|
width: Val::Px(200.),
|
||||||
height: Val::Px(200.),
|
height: Val::Px(200.),
|
||||||
@ -267,7 +267,7 @@ fn spawn_left_panel(builder: &mut ChildBuilder, palette: &[Color; 4]) -> Vec<Ent
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[3]),
|
background_color: BackgroundColor(palette[3]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.id();
|
.id();
|
||||||
target_ids.push(id);
|
target_ids.push(id);
|
||||||
})
|
})
|
||||||
@ -326,7 +326,7 @@ fn spawn_right_panel(
|
|||||||
spawn_buttons(parent, target_ids.pop().unwrap());
|
spawn_buttons(parent, target_ids.pop().unwrap());
|
||||||
|
|
||||||
parent
|
parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Px(400.),
|
width: Val::Px(400.),
|
||||||
height: Val::Px(400.),
|
height: Val::Px(400.),
|
||||||
@ -342,12 +342,12 @@ fn spawn_right_panel(
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[1]),
|
background_color: BackgroundColor(palette[1]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
spawn_buttons(parent, target_ids.pop().unwrap());
|
spawn_buttons(parent, target_ids.pop().unwrap());
|
||||||
|
|
||||||
parent
|
parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Px(300.),
|
width: Val::Px(300.),
|
||||||
height: Val::Px(300.),
|
height: Val::Px(300.),
|
||||||
@ -363,12 +363,12 @@ fn spawn_right_panel(
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[2]),
|
background_color: BackgroundColor(palette[2]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
spawn_buttons(parent, target_ids.pop().unwrap());
|
spawn_buttons(parent, target_ids.pop().unwrap());
|
||||||
|
|
||||||
parent
|
parent
|
||||||
.spawn((NodeBundle {
|
.spawn(NodeBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Px(200.),
|
width: Val::Px(200.),
|
||||||
height: Val::Px(200.),
|
height: Val::Px(200.),
|
||||||
@ -384,7 +384,7 @@ fn spawn_right_panel(
|
|||||||
},
|
},
|
||||||
background_color: BackgroundColor(palette[3]),
|
background_color: BackgroundColor(palette[3]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},))
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
spawn_buttons(parent, target_ids.pop().unwrap());
|
spawn_buttons(parent, target_ids.pop().unwrap());
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ fn setup(
|
|||||||
..default()
|
..default()
|
||||||
})
|
})
|
||||||
.with_children(|parent| {
|
.with_children(|parent| {
|
||||||
parent.spawn((AtlasImageBundle {
|
parent.spawn(AtlasImageBundle {
|
||||||
style: Style {
|
style: Style {
|
||||||
width: Val::Px(256.),
|
width: Val::Px(256.),
|
||||||
height: Val::Px(256.),
|
height: Val::Px(256.),
|
||||||
@ -59,7 +59,7 @@ fn setup(
|
|||||||
texture_atlas: texture_atlas_handle,
|
texture_atlas: texture_atlas_handle,
|
||||||
texture_atlas_image: UiTextureAtlasImage::default(),
|
texture_atlas_image: UiTextureAtlasImage::default(),
|
||||||
..default()
|
..default()
|
||||||
},));
|
});
|
||||||
parent.spawn(TextBundle::from_sections([
|
parent.spawn(TextBundle::from_sections([
|
||||||
TextSection::new("press ".to_string(), text_style.clone()),
|
TextSection::new("press ".to_string(), text_style.clone()),
|
||||||
TextSection::new(
|
TextSection::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user