2021-12-08 20:53:35 +00:00
|
|
|
/// An example of how to display a window in transparent mode
|
|
|
|
/// [Documentation & Platform support.](https://docs.rs/bevy/latest/bevy/prelude/struct.WindowDescriptor.html#structfield.transparent)
|
2021-12-14 03:58:23 +00:00
|
|
|
use bevy::{prelude::*, window::WindowDescriptor};
|
2021-12-08 20:53:35 +00:00
|
|
|
|
|
|
|
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,
|
2022-03-01 20:52:09 +00:00
|
|
|
..default()
|
2021-12-08 20:53:35 +00:00
|
|
|
})
|
|
|
|
.add_startup_system(setup)
|
|
|
|
.add_plugins(DefaultPlugins)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2021-12-14 03:58:23 +00:00
|
|
|
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
2021-12-08 20:53:35 +00:00
|
|
|
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
|
|
|
|
commands.spawn_bundle(SpriteBundle {
|
2021-12-14 03:58:23 +00:00
|
|
|
texture: asset_server.load("branding/icon.png"),
|
2022-03-01 20:52:09 +00:00
|
|
|
..default()
|
2021-12-08 20:53:35 +00:00
|
|
|
});
|
|
|
|
}
|