1

I would like to create a bevy window that: Has no background Has no window decoration Is always on top Doesn’t interfere with input to the underlying window.

I have done some research, and I think that on windows you can set a value called “input transparency” on the window, which defines if windows underneath can also receive input. Bevy-rs is a simplistic rust library, so I don’t know if I can make this work very easily. Is there a way I could make this work? Will I have to modify the wgpu-rs underlying code? Or will I have to use another game engine apart from Bevy?

Bevy version: 0.8.0

James G
  • 13
  • 4
  • It doesn't look to me like bevy or winit (the crate supporting bevy's windowing) support this. – PitaJ Aug 15 '22 at 15:25

1 Answers1

0

This should be possible mostly out of the box once bevy 0.10 releases (Should release possibly as early as next week). 0.10.0 adds support for disabling hittest for input passthrough. Transparent windows are already supported.

let window_descriptor = WindowDescriptor {
    // Enable transparent support for the window
    transparent: true,
    decorations: false,
    always_on_top: true,
    // Allows inputs to pass through to apps behind this app. New to bevy 0.10
    hittest: false,
    width: 800.0,
    height: 600.0,
    ..default()
};

App::new()
    // Make it render background as transparent
    .insert_resource(ClearColor(Color::NONE))
    .add_plugins(DefaultPlugins.set(WindowPlugin {
        window: window_descriptor,
        ..default()
    }))

You will probably want to use https://crates.io/crates/bevy_global_input to get input while the window isn't focused as bevy doesn't support that out of the box.

If you want to use bevy 0.9 the guy that contributed the changes for this has a 0.9 branch with the changes applied here: https://github.com/laundmo/bevy/tree/bevy_0.9_overlay

Here's an example where I did this for a weekend project: https://mastodon.gamedev.place/@paul/109604847674290795

Some helpful discussion on the discord thread for that project too: https://discord.com/channels/691052431525675048/692648638823923732/1058481406730317907

Paul Hansen
  • 1,167
  • 1
  • 10
  • 23