 81b53d15d4
			
		
	
	
		81b53d15d4
		
	
	
	
	
		
			
			Resolves #1253 #1562 This makes the Commands apis consistent with World apis. This moves to a "type state" pattern (like World) where the "current entity" is stored in an `EntityCommands` builder. In general this tends to cuts down on indentation and line count. It comes at the cost of needing to type `commands` more and adding more semicolons to terminate expressions. I also added `spawn_bundle` to Commands because this is a common enough operation that I think its worth providing a shorthand.
		
			
				
	
	
		
			22 lines
		
	
	
		
			682 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			682 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use bevy::prelude::*;
 | |
| 
 | |
| fn main() {
 | |
|     App::build()
 | |
|         .insert_resource(Msaa { samples: 4 })
 | |
|         .add_plugins(DefaultPlugins)
 | |
|         .add_startup_system(setup.system())
 | |
|         .run();
 | |
| }
 | |
| 
 | |
| fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
 | |
|     commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"));
 | |
|     commands.spawn_bundle(LightBundle {
 | |
|         transform: Transform::from_xyz(4.0, 5.0, 4.0),
 | |
|         ..Default::default()
 | |
|     });
 | |
|     commands.spawn_bundle(PerspectiveCameraBundle {
 | |
|         transform: Transform::from_xyz(0.7, 0.7, 1.0).looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
 | |
|         ..Default::default()
 | |
|     });
 | |
| }
 |