diff --git a/framework_crates/bones_bevy_renderer/src/render.rs b/framework_crates/bones_bevy_renderer/src/render.rs index 7c052f9250..67c8e0c57b 100644 --- a/framework_crates/bones_bevy_renderer/src/render.rs +++ b/framework_crates/bones_bevy_renderer/src/render.rs @@ -112,6 +112,7 @@ pub fn sync_bones_window(mut game: ResMut, mut window_query: Query<&m game.insert_shared_resource(bones::Window { size: vec2(window.width(), window.height()), fullscreen: matches!(&window.mode, WindowMode::BorderlessFullscreen), + focused: window.focused, }); game.shared_resource_cell().unwrap() } @@ -126,6 +127,7 @@ pub fn sync_bones_window(mut game: ResMut, mut window_query: Query<&m WindowMode::Windowed }; } + bones_window.focused = window.focused; bones_window.size = vec2(window.width(), window.height()); } diff --git a/framework_crates/bones_framework/src/input/window.rs b/framework_crates/bones_framework/src/input/window.rs index 2f951448e3..75f611f282 100644 --- a/framework_crates/bones_framework/src/input/window.rs +++ b/framework_crates/bones_framework/src/input/window.rs @@ -13,4 +13,9 @@ pub struct Window { pub size: glam::Vec2, /// May be set to change whether or not the game is displayed full-screen. pub fullscreen: bool, + /// Whether or not the window is focused. + /// + /// This is considered read-only and is updated from the window focus by the + /// rendering integration. + pub focused: bool, }