From 503c24717321bb2bb2681b358020ad1bcbef510e Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Mon, 18 Apr 2022 20:05:53 +0100 Subject: [PATCH] Also test 2d See --- examples/window/minimising.rs | 18 ++++++++++++++++-- examples/window/resizing.rs | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/examples/window/minimising.rs b/examples/window/minimising.rs index 1425d88117e22d..8f843a03c0043f 100644 --- a/examples/window/minimising.rs +++ b/examples/window/minimising.rs @@ -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(); } @@ -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>, mut materials: ResMut>, @@ -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() + }); +} diff --git a/examples/window/resizing.rs b/examples/window/resizing.rs index 79ad5fafbd323f..1504d42e4c7ede 100644 --- a/examples/window/resizing.rs +++ b/examples/window/resizing.rs @@ -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(); } @@ -97,7 +98,7 @@ fn sync_dimensions(dim: Res, mut windows: ResMut) { } /// A simple 3d scene, taken from the `3d_scene` example -fn setup( +fn setup_3d( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, @@ -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() + }); +}