-
I'm creating an app for Linux. (x11, not wayland) It creates a translucent window on the primary monitor, and displays various information. It's like an overlayed information board. I'd like to add an ability to resize the window according to monitor size, such as "Height is 50px, width is 1/4 of the monitor width". How do I get the size of the (primary) monitor? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't think that this functionality is directly exposed through Bevy types. It is possible to look up the corresponding the winit Window for a Bevy Window and use various convenience functions for dealing with monitors from that struct. fn print_monitor_size(winit_windows: NonSend<WinitWindows>, window_query: Query<Entity, With<PrimaryWindow>>) {
if let Some(monitor) = window_query
.get_single()
.ok()
.and_then(|entity| winit_windows.get_window(entity))
.and_then(|winit_window| winit_window.current_monitor())
{
info!("{:?}", monitor.size());
}
} |
Beta Was this translation helpful? Give feedback.
I don't think that this functionality is directly exposed through Bevy types. It is possible to look up the corresponding the winit Window for a Bevy Window and use various convenience functions for dealing with monitors from that struct.