I have some code to display some things on a transparant window like this:
fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { // Setting transparentallows theClearColor`'s alpha value to take effect
transparent: true,
// Disabling window decorations to make it feel more like a widget than a window
decorations: false,
resolution: WindowResolution::new(WINDOW_WIDTH, WINDOW_HEIGHT),
#[cfg(target_os = "macos")]
composite_alpha_mode: CompositeAlphaMode::PostMultiplied,
#[cfg(target_os = "linux")]
composite_alpha_mode: CompositeAlphaMode::PreMultiplied,
..default()
}),
..default()
}))
// ClearColor must have 0 alpha, otherwise some color will bleed through
.insert_resource(ClearColor(Color::NONE))
//also update system to display some stuff
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
}`
On my mac this worked nicely, but today I tried it on my windows pc and it gives a black background instead. I see that theres some special code that's only used for mac and not for windows, but I based myself on https://github.com/bevyengine/bevy/blob/latest/examples/window/transparent_window.rs so I thought there would be a good reason that windows wasn't included? Any ideas on how to resolve this? If I use the composit alpha mode for mac I get an error that only Opaque is possible and that also gives me a black background...
