Skip to content

Commit

Permalink
Also test 2d
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Apr 18, 2022
1 parent 4ae5f9e commit 503c247
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
18 changes: 16 additions & 2 deletions examples/window/minimising.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ fn main() {
.insert_resource(MinimiseTimer(Timer::new(Duration::from_secs(2), false)))
.add_plugins(DefaultPlugins)
.add_system(minimise_automatically)
.add_startup_system(setup)
.add_startup_system(setup_3d)
.add_startup_system(setup_rect)
.run();
}

Expand All @@ -31,7 +32,7 @@ fn minimise_automatically(
}

/// A simple 3d scene, taken from the `3d_scene` example
fn setup(
fn setup_3d(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
Expand Down Expand Up @@ -65,3 +66,16 @@ fn setup(
..default()
});
}

/// A simple 2d scene, taken from the `rect` example
fn setup_rect(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
commands.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.25, 0.25, 0.75),
custom_size: Some(Vec2::new(50.0, 50.0)),
..default()
},
..default()
});
}
18 changes: 16 additions & 2 deletions examples/window/resizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ fn main() {
.add_system(change_window_size)
.add_system(sync_dimensions)
.add_system(exit_on_esc_system)
.add_startup_system(setup)
.add_startup_system(setup_3d)
.add_startup_system(setup_rect)
.run();
}

Expand Down Expand Up @@ -97,7 +98,7 @@ fn sync_dimensions(dim: Res<Dimensions>, mut windows: ResMut<Windows>) {
}

/// A simple 3d scene, taken from the `3d_scene` example
fn setup(
fn setup_3d(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
Expand Down Expand Up @@ -131,3 +132,16 @@ fn setup(
..default()
});
}

/// A simple 2d scene, taken from the `rect` example
fn setup_rect(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
commands.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.25, 0.25, 0.75),
custom_size: Some(Vec2::new(50.0, 50.0)),
..default()
},
..default()
});
}

0 comments on commit 503c247

Please sign in to comment.