mirror of
https://github.com/bevyengine/bevy
synced 2024-11-28 23:50:20 +00:00
de004da8d5
# Objective The migration process for `bevy_color` (#12013) will be fairly involved: there will be hundreds of affected files, and a large number of APIs. ## Solution To allow us to proceed granularly, we're going to keep both `bevy_color::Color` (new) and `bevy_render::Color` (old) around until the migration is complete. However, simply doing this directly is confusing! They're both called `Color`, making it very hard to tell when a portion of the code has been ported. As discussed in #12056, by renaming the old `Color` type, we can make it easier to gradually migrate over, one API at a time. ## Migration Guide THIS MIGRATION GUIDE INTENTIONALLY LEFT BLANK. This change should not be shipped to end users: delete this section in the final migration guide! --------- Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
40 lines
1.4 KiB
Rust
40 lines
1.4 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.
|
|
|
|
#[cfg(target_os = "macos")]
|
|
use bevy::window::CompositeAlphaMode;
|
|
use bevy::{
|
|
prelude::*,
|
|
window::{Window, WindowPlugin},
|
|
};
|
|
|
|
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(LegacyColor::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()
|
|
});
|
|
}
|