pub fn new(
        event_loop: EventsLoop,
        config: &Config,
        dimensions: Option<LogicalSize>,
    ) -> Result<Window> {
        let title = config.window.title.as_ref().map_or(DEFAULT_NAME, |t| t);

        let window_builder = Window::get_platform_window(title, &config.window);
        let windowed_context =
            create_gl_window(window_builder.clone(), &event_loop, false, dimensions)
                .or_else(|_| create_gl_window(window_builder, &event_loop, true, dimensions))?;
        let window = windowed_context.window();

        // Text cursor
        window.set_cursor(MouseCursor::Text);

        // Set OpenGL symbol loader. This call MUST be after window.make_current on windows.
        gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _);

        // On X11, embed the window inside another if the parent ID has been set
        #[cfg(not(any(target_os = "macos", windows)))]
        {
            if event_loop.is_x11() {
                if let Some(parent_window_id) = config.window.embed {
                    x_embed_window(window, parent_window_id);
                }
            }
        }

        let window = Window {
            event_loop,
            current_mouse_cursor: MouseCursor::Default,
            windowed_context,
            mouse_visible: true,
            is_focused: false,
        };

        Ok(window)
    }
/// Create a new window
///
/// This creates a window and fully initializes a window.
Create a new window
This creates a window and fully initializes a window.
Create a new window This creates a window and fully initializes a window .
pub fn new(
        event_loop: EventsLoop,
        config: &Config,
        dimensions: Option<LogicalSize>,
    ) -> Result<Window> {
        let title = config.window.title.as_ref().map_or(DEFAULT_NAME, |t| t);
        let window_builder = Window::get_platform_window(title, &config.window);
        let windowed_context =
            create_gl_window(window_builder.clone(), &event_loop, false, dimensions)
                .or_else(|_| create_gl_window(window_builder, &event_loop, true, dimensions))?;
        let window = windowed_context.window();
        // Text cursor
        window.set_cursor(MouseCursor::Text);
        // Set OpenGL symbol loader. This call MUST be after window.make_current on windows.
        gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _);
        // On X11, embed the window inside another if the parent ID has been set
        #[cfg(not(any(target_os = "macos", windows)))]
        {
            if event_loop.is_x11() {
                if let Some(parent_window_id) = config.window.embed {
                    x_embed_window(window, parent_window_id);
                }
            }
        }
        let window = Window {
            event_loop,
            current_mouse_cursor: MouseCursor::Default,
            windowed_context,
            mouse_visible: true,
            is_focused: false,
        };
        Ok(window)
    }
pub fn new ( event_loop : EventsLoop , config : & Config , dimensions : Option < LogicalSize > , ) -> Result < Window > { let title = config . window . title . as_ref ( ) . map_or ( DEFAULT_NAME , | t | t ) ; let window_builder = Window :: get_platform_window ( title , & config . window ) ; let windowed_context = create_gl_window ( window_builder . clone ( ) , & event_loop , false , dimensions ) . or_else ( | _ | create_gl_window ( window_builder , & event_loop , true , dimensions ) ) ? ; let window = windowed_context . window ( ) ; // Text cursor window . set_cursor ( MouseCursor :: Text ) ; // Set OpenGL symbol loader. This call MUST be after window.make_current on windows. gl :: load_with ( | symbol | windowed_context . get_proc_address ( symbol ) as * const _ ) ; // On X11, embed the window inside another if the parent ID has been set # [ cfg ( not ( any ( target_os " " windows ) ) ) ] { if event_loop . is_x11 ( ) { if let Some ( parent_window_id ) = config . window . embed { x_embed_window ( window , parent_window_id ) ; } } } let window = Window { event_loop , current_mouse_cursor : MouseCursor :: Default , windowed_context , mouse_visible : true , is_focused : false , } ; Ok ( window ) }
Create a new window
This creates a window and fully initializes a window.
Create a new window This creates a window and fully initializes a window .
event_loop
EventsLoop
config
&Config
dimensions
Option<LogicalSize>
event_loop
EventsLoop
config
&Config
dimensions
Option<LogicalSize>