pub fn menu_startup(
  mut commands: Commands,
  assets: Res<AssetServer>,
  windows: Res<Windows>,
  mut camera: Query<(&mut OrthographicProjection, &mut Transform), With<MainCamera>>,
) {
  let (mut camera_ortho, mut camera_trans) = camera.get_single_mut().unwrap();
  camera_ortho.scale = 0.5;
  camera_trans.translation = Vec3::new(0., 0., 999.);

  let primary_window = windows.get_primary().unwrap();

  commands
    .spawn_bundle(SpriteBundle {
      texture: assets.load("swpt_title.png"),
      sprite: Sprite {
        // Since it is a background, we should fit the sprite to the window
        custom_size: Some(Vec2::new(
          primary_window.width() / 2.,
          primary_window.height() / 2.,
        )),
        ..Default::default()
      },
      ..Default::default()
    })
    .insert(MenuSprite);
}
/// When the player exits and level and enters the menu:
/// - need to set the camera zoom and pan back to default
/// - Draw the game name
/// - Draw the characters
When the player exits and level and enters the menu:
need to set the camera zoom and pan back to default
Draw the game name
Draw the characters
When the player exits and level and enters the menu : need to set the camera zoom and pan back to default Draw the game name Draw the characters
pub fn menu_startup(
  mut commands: Commands,
  assets: Res<AssetServer>,
  windows: Res<Windows>,
  mut camera: Query<(&mut OrthographicProjection, &mut Transform), With<MainCamera>>,
) {
  let (mut camera_ortho, mut camera_trans) = camera.get_single_mut().unwrap();
  camera_ortho.scale = 0.5;
  camera_trans.translation = Vec3::new(0., 0., 999.);
  let primary_window = windows.get_primary().unwrap();
  commands
    .spawn_bundle(SpriteBundle {
      texture: assets.load("swpt_title.png"),
      sprite: Sprite {
        // Since it is a background, we should fit the sprite to the window
        custom_size: Some(Vec2::new(
          primary_window.width() / 2.,
          primary_window.height() / 2.,
        )),
        ..Default::default()
      },
      ..Default::default()
    })
    .insert(MenuSprite);
}
pub fn menu_startup ( mut commands : Commands , assets : Res < AssetServer > , windows : Res < Windows > , mut camera : Query < ( & mut OrthographicProjection , & mut Transform ) , With < MainCamera > > , ) { let ( mut camera_ortho , mut camera_trans ) = camera . get_single_mut ( ) . unwrap ( ) ; camera_ortho . scale = 0.5 ; camera_trans . translation = Vec3 :: new ( 0. , 0. , 999. ) ; let primary_window = windows . get_primary ( ) . unwrap ( ) ; commands . spawn_bundle ( SpriteBundle { texture : assets . load ( " " ) , sprite : Sprite { // Since it is a background, we should fit the sprite to the window custom_size : Some ( Vec2 :: new ( primary_window . width ( ) / 2. , primary_window . height ( ) / 2. , ) ) , .. Default :: default ( ) } , .. Default :: default ( ) } ) . insert ( MenuSprite ) ; }
When the player exits and level and enters the menu:
 need to set the camera zoom and pan back to default
 Draw the game name
 Draw the characters
When the player exits and level and enters the menu : need to set the camera zoom and pan back to default Draw the game name Draw the characters
commands
Commands
assets
Res<AssetServer>
windows
Res<Windows>
camera
Query<(&mut OrthographicProjection, &mut Transform), With<MainCamera>>
commands
Commands
assets
Res<AssetServer>
windows
Res<Windows>
camera
Query<(&mut OrthographicProjection, &mut Transform), With<MainCamera>>