mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 14:40:19 +00:00
3aaf746675
Co-authored-by: devil-ira <justthecooldude@gmail.com>
31 lines
1.1 KiB
Rust
31 lines
1.1 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.WindowDescriptor.html#structfield.transparent)
|
|
//! for more details.
|
|
|
|
use bevy::prelude::*;
|
|
|
|
fn main() {
|
|
App::new()
|
|
// ClearColor must have 0 alpha, otherwise some color will bleed through
|
|
.insert_resource(ClearColor(Color::NONE))
|
|
.insert_resource(WindowDescriptor {
|
|
// 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,
|
|
..default()
|
|
})
|
|
.add_startup_system(setup)
|
|
.add_plugins(DefaultPlugins)
|
|
.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()
|
|
});
|
|
}
|