Skip to content
Discussion options

You must be logged in to vote

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());
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mamekoro
Comment options

Answer selected by mamekoro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants