mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
30d84519a2
# Objective Bevy seems to want to standardize on "American English" spellings. Not sure if this is laid out anywhere in writing, but see also #15947. While perusing the docs for `typos`, I noticed that it has a `locale` config option and tried it out. ## Solution Switch to `en-us` locale in the `typos` config and run `typos -w` ## Migration Guide The following methods or fields have been renamed from `*dependants*` to `*dependents*`. - `ProcessorAssetInfo::dependants` - `ProcessorAssetInfos::add_dependant` - `ProcessorAssetInfos::non_existent_dependants` - `AssetInfo::dependants_waiting_on_load` - `AssetInfo::dependants_waiting_on_recursive_dep_load` - `AssetInfos::loader_dependants` - `AssetInfos::remove_dependants_and_labels`
77 lines
2.1 KiB
Rust
77 lines
2.1 KiB
Rust
//! A test to confirm that `bevy` allows minimizing the window
|
|
//! This is run in CI to ensure that this doesn't regress again.
|
|
use bevy::{core::FrameCount, prelude::*};
|
|
|
|
fn main() {
|
|
// TODO: Combine this with `resizing` once multiple_windows is simpler than
|
|
// it is currently.
|
|
App::new()
|
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
title: "Minimizing".into(),
|
|
..default()
|
|
}),
|
|
..default()
|
|
}))
|
|
.add_systems(Startup, (setup_3d, setup_2d))
|
|
.add_systems(Update, minimize_automatically)
|
|
.run();
|
|
}
|
|
|
|
fn minimize_automatically(mut window: Single<&mut Window>, frames: Res<FrameCount>) {
|
|
if frames.0 != 60 {
|
|
return;
|
|
}
|
|
|
|
window.set_minimized(true);
|
|
}
|
|
|
|
/// A simple 3d scene, taken from the `3d_scene` example
|
|
fn setup_3d(
|
|
mut commands: Commands,
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
) {
|
|
// plane
|
|
commands.spawn((
|
|
Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))),
|
|
MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))),
|
|
));
|
|
// cube
|
|
commands.spawn((
|
|
Mesh3d(meshes.add(Cuboid::default())),
|
|
MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
|
|
Transform::from_xyz(0.0, 0.5, 0.0),
|
|
));
|
|
// light
|
|
commands.spawn((
|
|
PointLight {
|
|
shadows_enabled: true,
|
|
..default()
|
|
},
|
|
Transform::from_xyz(4.0, 8.0, 4.0),
|
|
));
|
|
// camera
|
|
commands.spawn((
|
|
Camera3d::default(),
|
|
Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
|
|
));
|
|
}
|
|
|
|
/// A simple 2d scene, taken from the `rect` example
|
|
fn setup_2d(mut commands: Commands) {
|
|
commands.spawn((
|
|
Camera2d,
|
|
Camera {
|
|
// render the 2d camera after the 3d camera
|
|
order: 1,
|
|
// do not use a clear color
|
|
clear_color: ClearColorConfig::None,
|
|
..default()
|
|
},
|
|
));
|
|
commands.spawn(Sprite::from_color(
|
|
Color::srgb(0.25, 0.25, 0.75),
|
|
Vec2::new(50.0, 50.0),
|
|
));
|
|
}
|