mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
84363f2fab
# Objective - There are several redundant imports in the tests and examples that are not caught by CI because additional flags need to be passed. ## Solution - Run `cargo check --workspace --tests` and `cargo check --workspace --examples`, then fix all warnings. - Add `test-check` to CI, which will be run in the check-compiles job. This should catch future warnings for tests. Examples are already checked, but I'm not yet sure why they weren't caught. ## Discussion - Should the `--tests` and `--examples` flags be added to CI, so this is caught in the future? - If so, #12818 will need to be merged first. It was also a warning raised by checking the examples, but I chose to split off into a separate PR. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
37 lines
1.3 KiB
Rust
37 lines
1.3 KiB
Rust
//! Shows how to display a window in transparent mode.
|
|
//!
|
|
//! This feature works as expected depending on the platform. Please check the
|
|
//! [documentation](https://docs.rs/bevy/latest/bevy/prelude/struct.Window.html#structfield.transparent)
|
|
//! for more details.
|
|
|
|
use bevy::prelude::*;
|
|
#[cfg(target_os = "macos")]
|
|
use bevy::window::CompositeAlphaMode;
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
// Setting `transparent` allows the `ClearColor`'s alpha value to take effect
|
|
transparent: true,
|
|
// Disabling window decorations to make it feel more like a widget than a window
|
|
decorations: false,
|
|
#[cfg(target_os = "macos")]
|
|
composite_alpha_mode: CompositeAlphaMode::PostMultiplied,
|
|
..default()
|
|
}),
|
|
..default()
|
|
}))
|
|
// ClearColor must have 0 alpha, otherwise some color will bleed through
|
|
.insert_resource(ClearColor(Color::NONE))
|
|
.add_systems(Startup, setup)
|
|
.run();
|
|
}
|
|
|
|
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|
commands.spawn(Camera2dBundle::default());
|
|
commands.spawn(SpriteBundle {
|
|
texture: asset_server.load("branding/icon.png"),
|
|
..default()
|
|
});
|
|
}
|