pub fn build(&self) -> error::Result<Window> {
        let title = ffi::str_to_cstring(self.title);

        // SAFETY: ffi
        unsafe {
            // Initialize Window
            ffi::InitWindow(self.width as i32, self.height as i32, title.as_ptr());

            // Sets Window State
            #[cfg(target_os = "windows")]
            ffi::SetWindowState(self.config_flags as u32);
            #[cfg(not(target_os = "windows"))]
            ffi::SetWindowState(self.config_flags);

            // Check the window is well-initialized
            if !to_bool!(ffi::IsWindowReady()) {
                return Err(DiotekoErr::WindowInitFailedErr);
            }

            // Sets window icon
            if let Some(icon) = self.icon {
                // SAFETY: icon.take_raw() makes a temporary data
                ffi::SetWindowIcon(icon.take_raw())
            }

            // Sets exit key
            if let Some(exit_key) = self.exit_key {
                ffi::SetExitKey(exit_key.into());
            }
        }

        Ok(Window {
            width: self.width,
            height: self.height,
            title,
            config_flags: Cell::new(self.config_flags),
        })
    }
/// Initialize Window and OpenGL context with given configs
Initialize Window and OpenGL context with given configs
Initialize Window and OpenGL context with given configs
pub fn build(&self) -> error::Result<Window> {
        let title = ffi::str_to_cstring(self.title);
        // SAFETY: ffi
        unsafe {
            // Initialize Window
            ffi::InitWindow(self.width as i32, self.height as i32, title.as_ptr());
            // Sets Window State
            #[cfg(target_os = "windows")]
            ffi::SetWindowState(self.config_flags as u32);
            #[cfg(not(target_os = "windows"))]
            ffi::SetWindowState(self.config_flags);
            // Check the window is well-initialized
            if !to_bool!(ffi::IsWindowReady()) {
                return Err(DiotekoErr::WindowInitFailedErr);
            }
            // Sets window icon
            if let Some(icon) = self.icon {
                // SAFETY: icon.take_raw() makes a temporary data
                ffi::SetWindowIcon(icon.take_raw())
            }
            // Sets exit key
            if let Some(exit_key) = self.exit_key {
                ffi::SetExitKey(exit_key.into());
            }
        }
        Ok(Window {
            width: self.width,
            height: self.height,
            title,
            config_flags: Cell::new(self.config_flags),
        })
    }
pub fn build ( & self ) -> error :: Result < Window > { let title = ffi :: str_to_cstring ( self . title ) ; // SAFETY: ffi unsafe { // Initialize Window ffi :: InitWindow ( self . width as i32 , self . height as i32 , title . as_ptr ( ) ) ; // Sets Window State # [ cfg ( target_os " " ) ] ffi :: SetWindowState ( self . config_flags as u32 ) ; # [ cfg ( not ( target_os " " ) ) ] ffi :: SetWindowState ( self . config_flags ) ; // Check the window is well-initialized if ! to_bool ! ( ffi IsWindowReady ( ) ) { return Err ( DiotekoErr :: WindowInitFailedErr ) ; } // Sets window icon if let Some ( icon ) = self . icon { // SAFETY: icon.take_raw() makes a temporary data ffi :: SetWindowIcon ( icon . take_raw ( ) ) } // Sets exit key if let Some ( exit_key ) = self . exit_key { ffi :: SetExitKey ( exit_key . into ( ) ) ; } } Ok ( Window { width : self . width , height : self . height , title , config_flags : Cell :: new ( self . config_flags ) , } ) }
Initialize Window and OpenGL context with given configs
Initialize Window and OpenGL context with given configs
&self