ecs: make build_children closure FnMut to allow mutation of closue values
This commit is contained in:
		
							parent
							
								
									6022ad2c4f
								
							
						
					
					
						commit
						ec11a6a5f6
					
				| @ -71,7 +71,7 @@ impl<'a> WorldBuilder<'a> { | ||||
|         self | ||||
|     } | ||||
| 
 | ||||
|     pub fn add_children(&mut self, build_children: impl Fn(&mut Self) -> &mut Self) -> &mut Self { | ||||
|     pub fn add_children(&mut self, mut build_children: impl FnMut(&mut Self) -> &mut Self) -> &mut Self { | ||||
|         self.parent_entity = self.current_entity; | ||||
|         self.current_entity = None; | ||||
| 
 | ||||
| @ -160,7 +160,7 @@ impl<'a> CommandBufferBuilder<'a> { | ||||
|         self | ||||
|     } | ||||
| 
 | ||||
|     pub fn add_children(&mut self, build_children: impl Fn(&mut Self) -> &mut Self) -> &mut Self { | ||||
|     pub fn add_children(&mut self, mut build_children: impl FnMut(&mut Self) -> &mut Self) -> &mut Self { | ||||
|         self.parent_entity = self.current_entity; | ||||
|         self.current_entity = None; | ||||
| 
 | ||||
|  | ||||
| @ -32,8 +32,6 @@ fn setup( | ||||
|     let texture = textures.get(&texture_handle).unwrap(); | ||||
|     let aspect = texture.aspect(); | ||||
| 
 | ||||
|     let blue_material_handle = materials.add(Color::rgb(0.6, 0.6, 1.0).into()); | ||||
| 
 | ||||
|     command_buffer | ||||
|         .build() | ||||
|         // // cube
 | ||||
| @ -151,7 +149,7 @@ fn setup( | ||||
|                     Anchors::FULL, | ||||
|                     Margins::new(20.0, 20.0, 20.0, 20.0), | ||||
|                 ), | ||||
|                 material: blue_material_handle, | ||||
|                 material: materials.add(Color::rgb(0.6, 0.6, 1.0).into()), | ||||
|                 ..Default::default() | ||||
|             }) | ||||
|         }) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Carter Anderson
						Carter Anderson