Skip to content

Commit 665a026

Browse files
zicklagTekhnaeRaav
andauthored
feat: add window focused field. (#514)
Co-authored-by: Tekhnae Raav <tekhnaeraav@katharostech.com>
1 parent 10d72fc commit 665a026

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

framework_crates/bones_bevy_renderer/src/render.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub fn sync_bones_window(mut game: ResMut<BonesGame>, mut window_query: Query<&m
112112
game.insert_shared_resource(bones::Window {
113113
size: vec2(window.width(), window.height()),
114114
fullscreen: matches!(&window.mode, WindowMode::BorderlessFullscreen),
115+
focused: window.focused,
115116
});
116117
game.shared_resource_cell().unwrap()
117118
}
@@ -126,6 +127,7 @@ pub fn sync_bones_window(mut game: ResMut<BonesGame>, mut window_query: Query<&m
126127
WindowMode::Windowed
127128
};
128129
}
130+
bones_window.focused = window.focused;
129131
bones_window.size = vec2(window.width(), window.height());
130132
}
131133

framework_crates/bones_framework/src/input/window.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ pub struct Window {
1313
pub size: glam::Vec2,
1414
/// May be set to change whether or not the game is displayed full-screen.
1515
pub fullscreen: bool,
16+
/// Whether or not the window is focused.
17+
///
18+
/// This is considered read-only and is updated from the window focus by the
19+
/// rendering integration.
20+
pub focused: bool,
1621
}

0 commit comments

Comments
 (0)